A dedicated "cruisecontrol" account on the Linux system
Steps
Checkout the swinglabs/cruisecontrol module:
cvs -d:pserver:guest@cvs.dev.java.net:/cvs co swinglabs/cruisecontrol
You get the following directory structure:
\---swinglabs
\---cruisecontrol ant build file to deploy the CruiseControl setup
+---conf the project configuration
+---redist ant, cobertura and cruisecontrol archives
\---support scripts, xsl, jsp used by the build loop
\---cruisecontrol-web
\---WEB-INF
\---lib
Copy the file build.properties.default to build.properties, edit the file to match your environment.
cd swinglabs/cruisecontrol
cp build.properties.default build.properties
vi build.properties
Execute the ant script to deploy the CruiseControl? setup:
ant deploy
It creates a directory named "build" under "swinglabs/cruisecontrol" with the following content:
From now on, I will be referring to the build/cruisecontrol directory as CC_DIR.
At this point, CruiseControl? is installed but is not yet configured to build projects. With a standard CruiseControl? setup, you have to write a config.xml file which describes the projects to build, how often to build them, how to update them, how to compile them, who and how to notifiy when build fails. For our case, this would just be a copy/paste work as all projects share the same setup. So the chosen approach is a little bit different.The projects which are going to be built by CruiseControl? are listed into the file conf/projects.xml. This is not the standard CruiseControl? config file. This file lists the projects, for each project which version (tag, branch) of the project to build, and additional properties which may be passed to the build. The xml file is processed by a stylesheet to create the actual CruiseControl? configuration.
Generate the CruiseControl? configuration:
ant update
This step has to be executed whenever a new project or new branch needs to be added to the build loop. It copies conf/projects.xml to the deployment directory, checkout the projects/branches, generate the CruiseControl? configuration. The project checkouts are under CC_DIR/projects.
Time as shown that after some weeks or even only days sometime, the CruiseControl? loop just hangs which checking for CVS modifications. To circumvent this, CruiseControl? is (re)started by a crontab process every day at 4:00am. To register the crontab job:
crontab CC_DIR/crontab.time
Every day at 4:00am, the script CC_DIR/crontab.sh will be executed. This script kills all running java processed (only those of the "cruisecontrol" user), starts the CruiseControl? loop and runs a cleanup script. The goal of this cleanup script is to remove old CruiseControl? log files under CC_DIR/logs.