Wednesday 18 January 2012

Upgrading from CruiseControl.NET 1.5 to 1.6 / 1.7

I've finally decided to update the version of CruiseControl.NET I use, going from 1.5 straight to 1.7 nightly build. My previous attempt ended with cryptic error messages, but, as this time the build server was already having some problems and required maintenance, I went through with the update (after fixing the problems first, of course).

Most important thing, if you don't already know it: there's a validator included in the downloadable package, which you can use to check how the server will interpret your pretty configuration files spaghetti. If you are making use of the pre-processor feature - the validator is indispensable. A neat trick while using it is copying the output (processed) configuration, changing the input files and copying the new output to a separate file, then running diff on those two to check whether the actual change you just introduced is what you were intending to do. In my case - I was checking whether I got exactly the same output while using a two-years-newer release by running my original configuration through the 1.5 validator and trying to get identical results from the 1.7 parser.
The initial result you'll get will most likely be this:

Unused node detected: xmlns:cb="urn:ccnet.config.builder"

Oh. Not good. StackOverflow has an answer that claims to fix this problem, only to result in this:

Unused node detected: xmlns=""

Well - not exactly a change for the better.  What is the problem? The changes in the configuration parser made it a bit more picky about the files it accepts. Now they have to start with the XML preamble and include the version information (1.5 or 1.6, there's no 1.7 schema yet). The required beginning of the main configuration file is now as follows:

<?xml version="1.0" encoding="utf-8"?>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder"

Also, while 1.5 allowed you to include files containing a "naked" node (e.g. to reuse svn version control configuration), 1.6 requires the top level node in the included file to be either a <cb:config-template> or <cb:scope>. Thus, to be on the safe side, start each of your configuration sub-files with the following:

<?xml version="1.0" encoding="utf-8"?>
<cb:config-template xmlns:cb="urn:ccnet.config.builder"

With those changes in place, my configuration file results in the same pre-processor output both in CruiseControl.NET 1.5 and 1.7.