<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Julian Higman&#039;s Blog &#187; continuous integration</title>
	<atom:link href="http://julianhigman.com/blog/tag/continuous-integration/feed/" rel="self" type="application/rss+xml" />
	<link>http://julianhigman.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 27 Feb 2012 22:11:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using Jenkins to run remote deployment scripts over SSH</title>
		<link>http://julianhigman.com/blog/2012/02/25/using-jenkins-to-run-remote-deployment-scripts-over-ssh/</link>
		<comments>http://julianhigman.com/blog/2012/02/25/using-jenkins-to-run-remote-deployment-scripts-over-ssh/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 21:58:29 +0000</pubDate>
		<dc:creator>jhigman</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[jenkins]]></category>

		<guid isPermaLink="false">http://julianhigman.com/blog/?p=294</guid>
		<description><![CDATA[We use Jenkins to deploy code to multiple servers, so that we can manage builds and deployments from the same (even better if you&#8217;re using the Jenkins IRC plugin). The deployment is done by a parameterized build job, where the parameter is the version of the project that we want to deploy. The job will <a href='http://julianhigman.com/blog/2012/02/25/using-jenkins-to-run-remote-deployment-scripts-over-ssh/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>We use Jenkins to deploy code to multiple servers, so that we can manage builds and deployments from the same (even better if you&#8217;re using the <a title="Jenkins IRC Plugin" href="https://wiki.jenkins-ci.org/display/JENKINS/IRC+Plugin" target="_blank">Jenkins IRC plugin</a>).</p>
<p>The deployment is done by a parameterized build job, where the parameter is the version of the project that we want to deploy. The job will run remote commands over ssh on servers that you&#8217;ve defined in the Jenkins configuration. Those commands will pull down a version of our code, unpack it, and run the rest of the install steps.</p>
<p>&nbsp;</p>
<p>First you&#8217;ll need to install the <a title="Publish over SSH Plugin" href="https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin" target="_blank">Publish over SSH Plugin</a>, which will allow files to be transferred to your servers and remote commands to be run.</p>
<p>Set up the SSH key for remote access of your target servers, in the Manage Jenkins page:</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/ssh-key.png"><img class="aligncenter size-full wp-image-295" title="ssh-key" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/ssh-key.png" alt="" width="1176" height="453" /></a></p>
<p>and setup the definitions for each of the servers that you want to deploy to:</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/ssh-server.png"><img class="aligncenter size-full wp-image-298" title="ssh-server" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/ssh-server.png" alt="" width="1079" height="173" /></a></p>
<p>Then in the configuration for the new deployment job you&#8217;ve set up, you&#8217;ll use the &#8220;Send files or execute commands over SSH before the build starts&#8221; settings in the &#8220;Build Environment&#8221; section to remotely execute a script to carry out the install steps on each remote server:</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/remote-exec.png"><img class="aligncenter size-full wp-image-300" title="remote-exec" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/remote-exec.png" alt="" width="919" height="401" /></a></p>
<p>Notice that the build parameter &#8220;$version&#8221; is available to the Exec command that gets remotely executed &#8211; other Jenkins environment variables will also be available (e.g. $BUILD_NUMBER, $JOB_NAME etc).</p>
<p>Use the &#8220;Add Server&#8221; button to add more target servers, with the same Exec command.</p>
<p>Now you can deploy your project (or run any other remote scripts) by running the build job and specifying a version number.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://julianhigman.com/blog/2012/02/25/using-jenkins-to-run-remote-deployment-scripts-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building github branches with Jenkins</title>
		<link>http://julianhigman.com/blog/2012/02/22/building-github-branches-with-jenkins/</link>
		<comments>http://julianhigman.com/blog/2012/02/22/building-github-branches-with-jenkins/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 21:47:32 +0000</pubDate>
		<dc:creator>jhigman</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[jenkins]]></category>

		<guid isPermaLink="false">http://julianhigman.com/blog/?p=278</guid>
		<description><![CDATA[We usually work on several parallel branches of a repo on github, and we wanted to be able to build and test any branch on demand. So we set up a parameterised job in Jenkins that will take the name of a branch and run the build process. As for all github builds, you need <a href='http://julianhigman.com/blog/2012/02/22/building-github-branches-with-jenkins/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>We usually work on several parallel branches of a repo on github, and we wanted to be able to build and test any branch on demand.</p>
<p>So we set up a parameterised job in Jenkins that will take the name of a branch and run the build process.</p>
<p>As for all github builds, you need to have installed the git plugin first (<a href="https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin">https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin</a>) and set up your github globals in the Jenkins settings:</p>
<p>&nbsp;</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/jenkins-git-setup-1.png"><img class="aligncenter size-full wp-image-280" title="jenkins-git-setup-1" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/jenkins-git-setup-1.png" alt="" width="919" height="215" /></a></p>
<p>&nbsp;</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/jenkins-git-setup-2.png"><img class="aligncenter size-full wp-image-279" title="jenkins-git-setup-2" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/jenkins-git-setup-2.png" alt="" width="838" height="99" /></a></p>
<p>&nbsp;</p>
<p>Then set up a parameterized build job with the repo as the GitHub project and with &#8220;branch&#8221; as the parameter to be specified:</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/build-param.png"><img class="aligncenter size-full wp-image-289" title="build-param" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/build-param.png" alt="" width="825" height="130" /></a></p>
<p>and in the Source Code Management section, add the parameter to the &#8220;Branches to build&#8221;:</p>
<p><a href="http://julianhigman.com/blog/wp-content/uploads/2012/02/source-code.png"><img class="aligncenter size-full wp-image-290" title="source-code" src="http://julianhigman.com/blog/wp-content/uploads/2012/02/source-code.png" alt="" width="822" height="243" /></a>Don&#8217;t specify any build triggers &#8211; you&#8217;ll probably just want to run this on-demand against specific branches, rather than every time there&#8217;s a push to the repo (which is what happens by default).</p>
<p>Now you can build any branch just by giving the branch name as the required parameter when the job is started.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://julianhigman.com/blog/2012/02/22/building-github-branches-with-jenkins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CruiseControl is dead, long live Hudson</title>
		<link>http://julianhigman.com/blog/2009/01/21/cruisecontrol-is-dead-long-live-hudson/</link>
		<comments>http://julianhigman.com/blog/2009/01/21/cruisecontrol-is-dead-long-live-hudson/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 22:57:35 +0000</pubDate>
		<dc:creator>jhigman</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[lava lamps]]></category>

		<guid isPermaLink="false">http://julianhigman.com/blog/?p=29</guid>
		<description><![CDATA[We&#8217;ve been using Cruise Control as our continuous integration system for ages, but problems with Subversion checkouts finally drove us to try Hudson as an alternative. It&#8217;s fantastic &#8211; configurable from the UI, it archives build logs as well as artifacts, it&#8217;s got console output in the browser, and so on. Why didn&#8217;t we switch <a href='http://julianhigman.com/blog/2009/01/21/cruisecontrol-is-dead-long-live-hudson/' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using <a href="http://cruisecontrol.sourceforge.net/" target="_blank">Cruise Control</a> as our continuous integration system for ages, but problems with Subversion checkouts finally drove us to try <a href="https://hudson.dev.java.net/" target="_blank">Hudson </a>as an alternative.</p>
<p>It&#8217;s fantastic &#8211; configurable from the UI, it archives build logs as well as artifacts, it&#8217;s got console output in the browser, and so on. Why didn&#8217;t we switch earlier?!</p>
<p>Anyhow, only slight modification need to make the lava lamps work with Hudson.</p>
<p>The lamps are controlled by an <a href="http://www.digidave.co.uk/jshop/product.php?xProd=211&amp;xSec=1&amp;jssCart=ca42637dbb60bed7e57dea7ece0ce85c" target="_blank">IP power switch</a>, with the 4 outlets turned on or off by hitting a url with some GET parameters (ok, it&#8217;s not RESTful, but come on..). A cron job fires invokes the script every minute with the &#8220;check&#8221; command to parse the RSS feed of latest build results from Hudson, and light the lights accordingly.</p>
<p>Cron also calls the &#8220;off&#8221; function after 5pm, to save the lamps from burning out overnight.</p>
<p>The script is something like this :</p>
<pre>#!/bin/bash
check() {</pre>
<pre>        # check Hudson on localhost and switch on lamps accordingly</pre>
<pre>        FAILCOUNT=`wget -O - -o wget.log http://localhost:8080/rssLatest | grep FAIL | wc -l`</pre>
<pre>        PASSCOUNT=`wget -O - -o wget.log http://localhost:8080/rssLatest | grep SUCCESS | wc -l`</pre>
<pre>        if [ $FAILCOUNT != 0 ]; then</pre>
<pre>                echo  `date` " : BUILD HAS FAILED"</pre>
<pre>                fail</pre>
<pre>        elif [ $PASSCOUNT != 0 ]; then</pre>
<pre>                echo  `date` " : BUILD IS OK"</pre>
<pre>                pass</pre>
<pre>       fi</pre>
<pre>}</pre>
<pre>pass() {</pre>
<pre>        # switch outlet 1 on and 3 off</pre>
<pre>        wget http://ip-switch.local/Set.cmd?CMD=SetPower+P60=1+P62=0 -q --delete-after</pre>
<pre>}</pre>
<pre>fail() {</pre>
<pre>        # switch outlet 3 on and 1 off</pre>
<pre>        wget http://ip-switch.local/Set.cmd?CMD=SetPower+P60=0+P62=1 -q --delete-after</pre>
<pre>}</pre>
<pre>off() {</pre>
<pre>        # switch them all off and go home</pre>
<pre>        wget http://ip-switch.local/Set.cmd?CMD=SetPower+P60=0+P62=0 -q --delete-after</pre>
<pre>}</pre>
<pre>exit</pre>
]]></content:encoded>
			<wfw:commentRss>http://julianhigman.com/blog/2009/01/21/cruisecontrol-is-dead-long-live-hudson/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

