Cruise Control.NET

I was introduced to cruise control.net the other day – and was very impressed by its power, as well ease of setup and use. Cruise control.NET is a build tool that polls a source repository (eg sourcesafe, cvs) for changes. If changes have been made, it performs specified operations (such as a Nant Build, calling of execuatables / batch files and emailing specified persons with the result of the build). It can also apply a label to a source tree.

Installation of cruise control is ridicuosly simple – you just run an installer, set up a config file (C:\Program Files\CruiseControl.NET\server\ccnet.config) and set the ccnet program / service running. The installer even sets up a web dashboard on your machine (provided you have iis installed) – usually at http://localhost/ccnet.

In my first experience with cruise control.net, I set cruise control to poll a sourcesafe database every minute. If it detected a change in the source code (ie via a checkin etc) it called a nant build file (nant was also installed on my build server), before labelling sourcesafe and emailing relevant persons the results of builds (this includes and error generated by the nant build).

Note that when cruise control calls nant, it passed through parameters such as the label, status etc so you can run nant operations using these paramaters. See http://confluence.public.thoughtworks.org/display/CCNET/NAnt+Task

Note that there is only one config file, but this can contain multiple projects. Also note that log files are stored at C:\Program Files\CruiseControl.NET\server\nameofproject\Artifacts\buildlogs

The only major thing I have struggled with, is trying to set the build number to increment from a certain value. Within the project state file (called nameofproject.state, located at C:\Program Files\CruiseControl.NET\server) – there is a node called LastSuccessfulIntegrationLabel. I altered this after stopping cruise control, but this did not seem to have any effect – the build number sequence still continued from where it previously was.

Example ccnet.config (so I remember!)

<cruisecontrol>
    <project  name="testproject">
        <webURL>http://localhost/ccnet/</webURL>
        <triggers>
            <intervalTrigger  seconds="60"  />
        </triggers>
        <modificationDelaySeconds>60</modificationDelaySeconds>
        <sourcecontrol  type="vss"  autoGetSource="true"  applyLabel="true">
            <executable>C:\Program  Files\Microsoft  Visual  Studio\VSS\win32\SS.EXE</executable>
            <project>$/testproject/</project>
            <username>username</username>
            <password>password</password>
            <ssdir>//sourcesafeserver/repository</ssdir>
            <workingDirectory>C:\code</workingDirectory>
            <culture>en-GB</culture>
            <cleanCopy>false</cleanCopy>
        </sourcecontrol>
        <tasks>
            <exec  executable="C:\dosomething.bat"  />
            <nant>
                <executable>C:\Program  Files\NANT-0.85-RC2-BIN\nant-0.85-rc2\bin\nant.exe</executable>
                <baseDirectory>C:\code</baseDirectory>
                <buildArgs>-D:Version="ABuildArg"</buildArgs>
                <buildFile>C:\path\to\nantbuildfile.xml</buildFile>
                <buildTimeoutSeconds>3600</buildTimeoutSeconds>
            </nant>
        </tasks>
        <publishers>
                <xmllogger/>
                <email  from="cc@example.com"  mailhost="127.0.0.1"  includeDetails="TRUE">
                    <users>
                        <user  name="developer"  group="developers"  address="rob@rnowik.com"/>
                    </users>
                    <groups>
                        <group  name="developers"  notification="always"/>
                    </groups>
                </email>
        </publishers>
    </project>
</cruisecontrol>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>