CruiseControl Components

In this section, we cover the standard components that come with CruiseControl, and describe in general the architecture of CruiseControl. Instructions on how to configure each component are included in the tool's documentation.

Source Control Systems

CruiseControl uses components called source control systems to detect changes to projects. These components go into the <modificationset> element in the CruiseControl configuration file. Not all of these components actually talk to version control systems, but most do and so the name has stuck.

Bootstrappers

Bootstrappers are components used to update some or all of your project before the build officially kicks off. They were introduced to get around a significant problem: if you use the build script to obtain the latest version of your project, what do you do when the build script changes? At the very least, you should use a bootstrapper to update your build script. Bootstrappers also provide a convenient way to perform any other "pre-build" activity. You enter bootstrappers within the <bootstrappers> element. The word "bootstrapper" is a common term used in computing to describe a process that is done to enable another process. The term comes from the phrase "to pull yourself up by your bootstraps." In theory, there should be a bootstrapper to match each supported version control system. However, only some of the version control systems have bootstrappers at this time.

Builders

Builder components are what CruiseControl actually uses to build the project. In theory, any sort of mechanism could be used to build a project, but in practice it is only feasible to make a builder for a mechanism that can produce an XML log file. There is no requirement that the build mechanism be Java based; for example, both the Ant and Maven builders can (and should) be run by a supplied batch script. Although a CruiseControl configuration file can define many projects within it, at this time there is support for only one project to be built at a time. As such, there is only one active builder. In addition to building at regular intervals, as already demonstrated, builders can be supplied for timed builds or to be run at particular intervals. For example, a common usage is to supply a <schedule> element like this:

<schedule interval="30" >
 <ant antscript="build.sh" target="cruise-build" multiple="1" />
 <ant antscript="build.sh" target="full-cruise-build" multiple="5" />
 <ant antscript="build.sh" target="nightly-cruise-build" time="0830" />
 <ant antscript="build.sh" target="weekly-cruise-build" time="0305" day="Saturday" />
 <pause startTime="2100" endTime="0300" />
</schedule>

As you can see, this schedule runs the cruise-build task normally, but every fifth build will run the full-cruise-build. The nightly and weekly tasks provide for still more flexibility. These tasks are useful for running Ant tasks that are not desirable to run every build (presumably because they take too long to complete). You enter builder components within the <schedule> element.

BuildLoggers

BuildLoggers are used to supplement the log file that CruiseControl produces. By default, CruiseControl includes information on the build, along with information supplied by the source control components and the builder components. You enter BuildLoggers components within the <log> element.

The only BuildLogger to ship with CruiseControl is the Merge logger. This component merges the specified XML file (or XML files in the specified directory) into the log file.

LabelIncrementers

LabelIncrementers are used to determine the next label to be used on a project. You enter them within the <project> element. If you do not include one, the default incrementer is used.

Java Start Sidebar
Getting the Build Label

The build label that will be applied to the project (if it is successfully built) is available to the build scripts as a property called label. However, it will be applied only if the build is successful. Other properties of interest are cctimestamp (the time of this build), cclastbuildtimestamp (the time of the last build), and cclastgoodbuildtimestamp (the time of the last known good build).

Java End Sidebar

When you're registering a LabelIncrementer, it is possible to set it as the default incrementer (thus allowing it to be omitted, if you're happy with its default behavior). To do this, simply name the plug-in labelincrementer. This trick works for overriding the behavior of any component; however, it is normally more sensible to use a different name for the overriding component. The LabelIncrementer is a special case, due to the fact that it can be omitted.

uploaders

uploader components are run after the build is complete, and after the resulting log file is finalized. The intent of these components is to publish the results of the build. You enter uploader components within the <uploaders> element.