On my current project, we’re using 37Signals’ Campfire for team chat and collaboration. We also use CruiseControl.NET for continuous integration. I thought it would be nice to have CruiseControl.NET automatically post build results into the Campfire chat room, to raise visibility of the build status out of the system tray and into the browser.
Implementing CruiseControl.NET plugins is quite straightforward, and Campfire has a very simple XML-over-HTTP API for posting messages into chatrooms. The code for the plugin is available on my github account. There are instructions there for using the plugin in your environment.
For the CruiseControl.NET integration, I found this blog post from Kris Selden very useful. The one thing I wasn’t sure about was how to handle errors. I didn’t want to risk exceptions being thrown from my plugin causing the build to fail. If something’s going to go wrong, I’d rather the plugin failed silently – we’ll quickly notice the lack of messages appearing in Campfire and look into it – so I made sure that I catch all exceptions and use CruiseControl.NET’s log4net facility to write to the server log.
I did have one problem with the Campfire API. I forgot to set the Content-Type HTTP header. Without this I was getting the HTTP response code 422 Unprocessable Entity, with a message “Body can't be blank”. This confused me for a while as I was definitely sending a well formed XML message with a body element. Setting the Content-Type header to application/xml fixed the problem.

Wow this took me too long to find out, thanks for posting this. We use cruisecontrol too and we were looking to do this same thing. I'm writing a pluggable client, but this has been stoping me.
ReplyDeleteThanks again for the post