Continuous integration on multiple platforms with CruiseControl
Principle
Run different instances of CruiseControl on different platforms to have a multi-platform continuous integration. Why? Because all source codes aren't platform independent and so integration process has to be multi-platform.

Requirement
- CruiseControl 2.3.0.1 or above
- A multi-platform buildable project
- A network accessible partition
- Several computers (one for each desired integration platform) with clean build environment + J2SE >= 1.4 (to run CC)
Encountered problems
CruiseControl hasn't been conceived to run on different platforms simulteanously. You have to take some precautions:
CC instances must write on different logfiles
Edit your CC_INSTALL_DIR/main/dist/cruisecontrol.jar/log4j.properties:
log4j.appender.FILE.File=logs/cc_$\{os.name\}.log
You can use another java environment variable.
Project name must include platform identifier (otherwise CC instances will overwrite the same project sources and logs).
At this time (september 2005) CC official build (2.3.0.1) doesn't support project names based on properties. Jérôme Lacoste has worked on a patch to fix it.
- You can download a CC dev build including this patch : moca-build >= 95.
- The 2.3.0.1 CC build solution consists in copying the config file, modifying it for each platform, and passing it to CC with "-configfile" option. A good way to do that is that the plateform identifier appears in the configfile names. Then you edit only some of the properties.
Configuration
CC config file (default : config.xml)
<cruisecontrol>
<property environment="env"/>
<project name="project1_${env.OS}">
<listeners>
<currentbuildstatuslistener
file="logs/${project.name}/buildstatus.txt"/>
</listeners>
<modificationset quietperiod="1200"
requiremodification="true">
<svn RepositoryLocation="https://xxxxxx/svn/project1/trunk/ktpplus"
username="xxxxxx"/>
<svn RepositoryLocation="https://xxxxxx/svn/project1/trunk/integration"
username="xxxxxx"/>
</modificationset>
<schedule interval="300">
<ant antscript="xxxx/bin/ant"
buildfile="build-project1.xml"
target="build"
uselogger="true"
usedebug="false"
antWorkingDir=".">
<property name="platform" value="${env}"/>
</ant>
</schedule>
<log dir="logs/${project.name}"/>
<publishers>
<email buildresultsurl="http://xxxxxx/cruisecontrol/buildresults/${project.name}"
mailhost="xxxxxx"
returnaddress="xxxxxx"
subjectprefix="CC ${project.name}"
skipusers="true">
<failure address="xxxxxx" reportWhenFixed="true" />
</email>
</publishers>
</project>
</cruisecontrol>
Warning : Environment variable "OS" must be set on every computer.
You will have the following directory structure :
- config.xml
- build-project1.xml
- logs/project1_SunOS
- logs/project1_Linux
- logs/project1_Windows_NT
Go further
Centralised integration service with JMX and rhost
Usage: integration.sh{start|stop|status|pause|resume}
To use it, you have to patch your CC_INSTALL_DIR/main/dist/cruisecontrol.jar.
Add these files at cruisecontrol.jar/net/sourceforge/cruisecontrol/jmx/xsl : value.xsl projectName.xsl
Per machine properties
- etc/SunOS.ccproperties
- etc/Linux.ccproperties
- etc/AIX.ccproperties
<property file="etc/${env.OS}.ccproperties"/>
Disadvantages
All your CC instances are running the same projects because they use the same config files. You can get over that by using customized config file as a parameter at execution time to CC. But the maintenance isn't user friendly anymore.
Thanks to Jerome Lacoste who has made patches which make multi-platform config files support possible.