Thursday, August 5, 2010

Hudson build by email

Although this is pretty well documented by the Hudson wiki (see Builds by e-mail (sendmail) and Builds by e-mail (qmail)):

http://wiki.hudson-ci.org/display/HUDSON/Building+a+software+project

we're running against Windows machines and I wanted to try a proof of concept for that. So the following is a non-scalable proof of concept, but does show the idea works:

1. Hudson has a configuration choice to pass tokens to an URL that will automatically initiate and on demand build remotely, so it's possible to do this by email

2. In the Hudson configuration for the build, there's a section named 'Build Triggers' and a checkbox 'Trigger builds remotely (e.g., from scripts)'. Check this box, then enter a value for the Authentication Token

3. In this proof of concept design an exe was created on a client that had these lines:
start iexplore http://server:port/hudson/job/job_name/build?token=authentication_token
ping -n 20 127.0.0.1
taskkill /im iexplore.exe

4. Then an Outlook email rule was set up on the client with these parameters: When a message arrives with 'Run job_name' in the subject, start remote_test.exe

5. Now when you send a mail to this client it will open a browser, pass the token in the URL and begin the build

Wednesday, August 4, 2010

Hudson deploys and Linux/Tomcat

One of the problems we had running on for a very long time was Tomcat stopping on a deploy to a Linux server once the deploy job had completed. This was working fine on the Windows servers so I was stumped as to the issue.
A little searching on the net led to these links and solution:

http://wiki.hudson-ci.org/display/HUDSON/Spawning+processes+from+build

http://wiki.hudson-ci.org/display/HUDSON/Post+build+task

The bottom line of this is that when you configure a build or deploy that is experiencing this issue, just choose 'Post build task' from the 'Post-build Actions' section in the job configuration.
To get the Tomcat server started on the dev Linux boxes I then just needed this in the 'Script' box:
/opt/apache-tomcat-6.0.20/bin/startup_nohup.sh
Now the Tomcat service stays running when the Hudson job completes