Wednesday, September 24, 2008

Bamboo Build Details Ant Task

Update
The code is now available as a google opensource project: http://code.google.com/p/bamboo-ant-tasks/

Any news about the ant task will be posted there, and/or on my personal blog: http://daniel-rijkhof.blogspot.com

What is it?
I build an ant task to get status information about bamboo builds. The task is build for and tested on bamboo 1.2.4. The current features include:
• Getting latest build number and latest build status (by build plan)
• Getting the status from any build (by build plan and build number)

Why is it useful
As a developer I want to have fully automated deployment on my environments. I can accomplish this with an Ant script. Our product is build on a bamboo build server. What stopped me?
• Our bamboo server cannot access our environments
• Bamboo does not provide direct links to the latest build artifacts (it does provide a redirect)
• Bamboo does not provide me with status information about the latest build

This ant task provides a way to fully automate deployment of the latest bamboo build, and add a sanity check to the automated deploy script (check if the build was successful).

Usage:
<property name="buildplan" value="your-buildplan-name-goes-here"/>
<property name="buildserver" value="http://bamboo.quintor.nl/"/>

<taskdef classpath="your-location-of/bamboo-ant-tasks.jar" classname="GetBambooBuildDetails" name="getBuildDetails"/>

<target name="shortExample">
<getBuildDetails server="${server}" buildplan="${buildplan}" buildnumberProperty="buildnumber"/>
<echo>buildnumber: ${buildnumber}</echo>
</target>

You'll have to change the red lines to make it work on your own bamboo server.

Don't forget to take a look at the example in the download package, where all parameters are used! In case there are any questions left, comment on this blog article.

Download:
You can download the task here: bamboo-ant-tasks.zip
The download contains the following:
• The source code of the ant task
• bamboo-ant-tasks.jar in the /target/dist dir, which includes only the compiled task
• Build script to build the jar
• 2 examples fullExample and shortExample, showing how to use this task (see build.xml)

The package is actually my eclipse project, so it will include .classpath and project files, and the ant.jar thats needed to compile.

Update
I fixed a bug found by Marcel; the ant task couldn't handle the status of an build that fixed previously failed build(s).

The download contains the newest code.

Please leave a comment :Daniel

2 comments:

Anonymous said...

Thanks for the article.
I was not able to download the tasks zip file.
Can you look into it?

Daniel Rijkhof said...

I'll update the blog post right now... read the top section :D