CruiseControl permanent link to latest successful build

Build, Deploy, Software No Comments »

In my current project we have some deployment scripts written in Ant. We can deploy a new version of the application as built by CruiseControl by running the command “ant deploy-war -Dwarfile=http://cruise-box/artifacts/killer_app/BUILD_TIMESTAMP/killer_app.war“.

Most of the time we want to deploy the latest successful build. We manually get the timestamp of the build from the CruiseControl dashboard and substitute it into the command above. It would be nice to default the warfile property to the latest successful build. For that we need CruiseControl to give us a well known link to the latest successful build.

I solved this problem using symbolic links. We can do this because our CruiseControl server runs on Linux but we could have achieved a similar result with a file system copy or an artifact publisher under Windows. I created the following helper Ant script to create a symbolic link using the Symlink task.

I then added a call to the helper script in the CruiseControl config.xml as an Ant publisher executed after a successful build.

I had to do it in an Ant script rather than calling the ln command directly with an execute publisher because I couldn’t work out how to access the build timestamp from within CruiseControl’s config.xml.

We can now access the latest successful build through the URL http://cruise-box/artifacts/killer_app/latest-successful/killer_app.war. The last step is to default the warfile property in our deployment scripts to this URL. We can now run “ant deploy-war” to deploy the latest successful build, or provide the property as before to deploy a different build.

© 2007 Tomas Varsavsky, All Rights Reserved. WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login