Monday, October 13, 2008

Abandoned CruiseControl

Cruisecontrol is used alot in here (at the office where I work, that is).
The version of CruiseControl that I installed is the latest one : Binary distro 2.7.3.

So it came just natural that I had to deep-dive into it, mainly for understanding strange behaviour or missing behaviour, for an example on the logging side of the application and on configuring the dashboard (which was not easy at all).

The documentation that you can find at CruiseControl's main project page is not complete. Really, it is not. It covers mainly all of the configuration file options and grammar, and that is it.
Absolutely *no* clue about how to configure and setup a dashboard, or hints about how to customize logging, how to integrate and correctly visualize logging into legacy build chains etc etc.
Wow. It's the first time ever that I see a free software project this big with almost no documentation.

Let me tell you what happened when I tried to get the dashboard to work. It should be as simple as adding a few switches on the CC command line (in the cruisecontrol.bat file), but it's not, because quite a few basic jar modules are missing. So what did I do. I enabled CC debugging with the -debug switch and parsed to 5 Megs logs at a time for almost three days. Not the easiest of tasks but my time is paid anyway, so who cares. It was worth it, I managed to get all the missing jars. But I lost two day's time to look after pieces of SW that should had been there.

Well, you would say that that is it. Wait, there is alot more to come. Another slightly unimportant feature as logging has been kept out of the scope of the main documentation.
For an example, I assume you all know that Cruisecontrol uses Ant internally. Did you also know that Cruisecontrol logs all the messages posted by Ant on the stderr as "WARNING", the ones posted on the stdout as "INFO" and that errors that occour within the ant build (that is, exceptions) are traced as "ERRORS"? Let's see how many of you raise the hands.
It took some time to discover that, luckily on Nabble there are plenty of extremely usefull forums.

Thanks to those forums I managed to get the dashboard up and running, as well as understanding finally the way Cruisecontrol handles log files.

For an example : suppose you have a legacy tool chain to build your deployables which bases it's functionality on python scripts. Python scripts can be executed by ant through an exec command, which will spawn (create in nerdish, that is) a new process for the python interpreter.
Now, considering that probably CC uses ant to parse it's own configuration as well there are two ways to spawn a process :
  • Through an Ant Script
  • Directly from CruiseControl's configuration
The difference between the two calls is mainly in the way the call is handled : the spawned process ("task" in CruiseControl jargon) will be of different nature to Cruisecontrol depending on whom the call has been delegated to, thus the logging for it will be handled differently. It may even happen that it gets totally by the reporting application just because the task that had to be logged is unknown to cruisecontrol (which is *always* the case by the way).

No comments: