Using CruiseControl for your Continuous Build

To increase the quality of our source code in our current project I decided to start to use Continuous Integration. Although it is a wise choice to use this from the start of a project, for some reason it hadn’t been set up yet for this project. In this blog I will state the steps it took for us to install, configure and run CruiseControl on a Linux (Red Hat) machine.
CruiseControl is an open-source tool to set up a continuous build process using Ant. One requirement that should be met before starting to use continious integeration, is that there is already a ‘test’ target in your Ant building process and that you have written the Unit tests to test all your (main) classes. A continuous integration process that is not testing your code for failures isn’t of much use, is it? So if that is not the case then you first have to write the unit tests (using Junit or TestNG) and then have Ant these tests performed when building your code.

The steps that have to be taken are:

  • Install CruiseControl at the server
  • Install a client for your used Version System
  • Checkout your project in a CruiseControl folder
  • Setup the config.xml
  • [optional] Setup the mail server
  • Start CruiseControl
  • Install CruiseControl at the server

    Download the latest version (2.7 nowadays) of the zip file here. Place this zip file at your server (for instance) in the folder /opt/ and extract it with: sudo unzip cruisecontrol-bin-2.7.zip.

  • Install a client for your used Version System
    Since CruiseControl needs to check your source code in the repository and check it out if necessary, you will need to have a client installed for your versioning system. We are using SubVersion so I had to install a SubVersion client.
    First download the package to install ( make sure you pick one for your Linux distribution). I took the one for ‘Red Hat Enterprise Linux ES release 4’ that can be found here. AFter placing the package at your server you can test the installment of it with the following command:
    sudo rpm -Uhv –test CollabNetSubversion-client-1.4.4-1.i386.rpm
    If this doesn’t show any problem you can perfrom the real installation with the same command but leaving ‘–test’ out:
    sudo rpm -Uhv CollabNetSubversion-client-1.4.4-1.i386.rpm
    Now add the ‘svn’ command to the path variable so you can execute it in every directory by editing your profile with:
    sudo vi /etc/profile and add the folder ‘/opt/CollabNet_Subversion/bin’ to the path variable.
  • Checkout your project in a CruiseControl folder
    I created a subfolder ‘myproject’ in the directory ‘$cruisecontrol_home$/projects/’ and copied my sources in there from my windows environment (including the svn folders!). This way your newly installed svn client knows where it can find the SVN server and the necessary paths etc.
  • Setup the config.xml

    This is the most fun part! Of course you will not create your perfect configuration at once but with some trial & error and a lot of info here and here you will eventually create the configuration that meets your needs 🙂

  • Start CruiseControl

    To start CruiseControl you navigate to the ‘$cruisecontrol_home$’ directory and enter the command: sudo ./cruisecontrol.sh
    To stop CruiseControl I use the command sudo kill xxxxx, so if someone knows a better I way…

After a succesful build cycle you can now browse to the CruiseControl Dashboard, default at ‘http://yourserver:8080/, and watch the results.
That’s it! As I said before this was the first time I installed it on a linux xsystem, so I was pretty proud I got it all working in a rather short amount of time.

Advertisement

About Pascal Alma

Pascal is a senior IT consultant and has been working in IT since 1997. He is monitoring the latest development in new technologies (Mobile, Cloud, Big Data) closely and particularly interested in Java open source tool stacks, cloud related technologies like AWS and mobile development like building iOS apps with Swift. Specialties: Java/JEE/Spring Amazon AWS API/REST Big Data Continuous Delivery Swift/iOS
This entry was posted in Technical and tagged , , . Bookmark the permalink.

1 Response to Using CruiseControl for your Continuous Build

  1. Stephan says:

    Hi Pascal,

    Just a small tip: Maybe you should have a look at GForge AS (http://www.gforgegroup.com). The GForge AS will provide you with a complete Collaborative Development Environment, including CruiseControl, wiki, trackers (time tracking, incident tracking), document manager, release manager, mailing list, reporting modules and version control modules…. The ‘simple’ install is based on a VMware image, so you can start using it out-of-the-box!

    Grtz,
    Stephan.

Comments are closed.