Thursday, June 18, 2009

CruiseControl Hack - Kicking off builds from the command line

I'm really warming up to CruiseControl as a build management system. They've made configuration surprisingly powerful with plugin preconfiguration capability.

The challenge of today was to figure out how to kick off a forced build from the command line. It's an easy thing to do in a web browser, but I wanted to do it via an ssh terminal.

I was surprised that the answer didn't come right up in Google, but sure enough, the answer was out there. Specifically, it was on the CruiseControl Wiki.

To kick off a build, you need to make a request to the JMX service. This turns out to sound harder than it is. All you really need to do is use a tool like curl or wget to invoke just the right URL. In my case, I needed to hit:

 http://locahost:8080/invoke?
   objectname=CruiseControl+Project:name=Foo&
   operation=build&
   template=identity

Note: Foo is the project name defined in config.xml

For the full solution. grab invoke-build.sh and just drop that into a shell script. And you're done.

This makes me wonder what other goodies I can control via JMX...hmmm...

No comments:

Post a Comment