Configuring CruiseControl for Continuous Integration Builds

[article]
Summary:
Michael Sayko introduces CruiseControl, which enables the implementing CI of Java applications. Using CruiseControl's build loop, dashboard, and build resultsJSP, Michael shows how any Java development team can receive added value through this open source tool.

CruiseControl is a popular open source tool for implementing Continuous Integration (CI) of Java applications. The idea behind CI is simple. Build, regression test, and deploy your software application to a test environment every time a code change is committed to version control. If the code change causes the build to break, the regression test to fail, or a problem with the deployment, identify and correct the problem promptly.

CruiseControl is ideally suited for CI. It is a reliable tool that provides real value to Java development teams of any size. While CruiseControl is easy to install, it takes some effort to configure. Fortunately, this challenge can be overcome by understanding the structure and content of the CruiseControl configuration file. After reading the discussion below, you should be able to configure CruiseControl to implement a CI build.

Downloading and Installing CruiseControl
Before configuring CruiseControl, take a few minutes to download and install the software. CruiseControl is available in source and binary distributions from the CruiseControl downloads page . Installing the binary distribution is the quickest way to get started since this distribution contains everything needed to run CruiseControl.

Since CruiseControl is a Java application, it will run on any platform where a JDK is installed Simply select a directory to install CruiseControl then extract the zip file containing the binary distribution to that directory. The top-level CruiseControl directory will be named cruisecontrol-bin-<release>. This directory contains the UNIX shell script, cruisecontrol.sh, and the Windows batch file, cruisecontrol.bat. These files are used to start CruiseControl on UNIX and Windows platforms, respectively. The top-level CruiseControl directory also contains the CruiseControl configuration file, config.xml.

Understanding the Design of CruiseControl
Before attempting to configure CruiseControl, it is important to understand the design of this CI framework. Written in Java, CruiseControl is composed of three main modules: the build loop , the dashboard , and the build results JSP .

The build loop is the core of CruiseControl. It is the daemon process that wakes up at a user defined time interval to trigger a build. The build loop contains the logic to check your version control system for changes since the last build. If changes are detected, the build loop triggers the build and publishes the results.

The build loop relies on a system of plugins to implement the logic for all supported version control systems. The plugin architecture is one of the strengths of CruiseControl because it isolates the implementation details of the build loop for each supported version control tool.

The dashboard is the web-based GUI for viewing build results, manually triggering builds, and editing the CruiseControl configuration file. The dashboard reports the status of CruiseControl builds by project. Each project is defined in the CruiseControl configuration file.

The build results JSP displays the results of the build loop for a project. The page lists links to completed builds along the left side. The details of the selected build are displayed along the right side of the page.

Configuring CruiseControl
A project is the unit of work that CruiseControl uses to implement the build loop. Each project is defined in the CruiseControl configuration file, config.xml. (By the way, you can rename config.xml if you prefer to use another name for the CruiseControl configuration file. If you rename config.xml you will need to modify cruisecontrol.sh or cruisecontrol.bat to reference the new name.)

In addition to the project, config.xml defines all other configuration settings. However, the project is the only element that you need to configure to get started with CruiseControl.

After installing CruiseControl, edit config.xml in the top-level CruiseControl directory. Notice that config.xml starts

About the author

Michael  Sayko's picture Michael Sayko

Michael Sayko is a software configuration management consultant based in Austin, Texas. From serving as a build and release engineer on several projects, he is experienced with build and deployment automation of Java EE applications. You can reach Michael by email at mss@acm.org.

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!

Upcoming Events

Sep 22
Sep 24
Oct 12
Nov 09