Wednesday, 21 August 2013

Realizing Continuous Integration with Cruise Control.Net (CC.Net)

Cruise Control:

Cruise Control is free and open source build scheduler which is implemented using the .Net Framework. It composes of two components:
  1. Build Loop - The build loop is designed to run as a background process, which periodically checks the defined repository for changes in codebase, builds it and give the status as the final output.
  2. Reporting – Cruise Control provides a reporting application to browse the results of the builds along with this it also provides a dashboard for visual representations of the status.

As mentioned in by last post Cruise Control works with many source control systems (Some of the better know are TFS, SVN, and VSS etc…). Input for the build process is any parseable format so it can be integrated with any build tool (MSBuild, Nant, Maven etc…) which produces parseable format. In addition to that this is widely used because of its extensive documentation and also provides with the option of Mailing list.

Process of Cruise Control:

  •        Developer Checks-in the code
  •        Cruise Controls polls the Version control system (Repository) to see if there are any changes in  codebase
  •        If the changes are there, then Cruise Control triggers the build using the defined build tool, captures  the build data and produces the Build Status Report


It is a standalone application which enables the developers or any other team member to check the status of the builds on their local machines which can access the CC.Net Server.

High Level Architecture of CC.Net

Setup Cruise Control.Net

First of all download CC.Net EXE (CruiseControl.NET- from
Run that EXE as Administrator. While installing select all the three components

After the installation is complete, you can now access the dashboard by typing in the following URL:
At the physical path of installation you will see that there are three folders which have got created named:
  1.       webdashboard
  2.       Examples
  3.       server

In the “server” folder there is a file named “ccnet.config”. Open up this file to do the configuration for automated builds. We need to add four blocks named

  1. Project Configuration Block – Information about the Project that needs to be build, there can be multiple projects present in this config
  2. SourceControl block – From where the code needs to be checked out for the build
  3. Tasks block – Steps/Process of Build
  4. Publishers block – Generate output and produce reports(If needed dispatch emails also)

For adding these you can either refer to the links above or I am providing you with the sample config below:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
  <!-- This is your CruiseControl.NET Server Configuration file. Add your projects below! -->

  <project name="Sample Application">
    <!--set the sourcecontrol type to subversion and point to the subversion exe-->
    <sourcecontrol type="svn">
      <executable>C:\Program Files\TortoiseSVN\bin\svn.exe</executable>
      <intervalTrigger name="Cruise Control Continuous Integration" seconds="60" buildCondition="IfModificationExists" initialSeconds="30" />
      <!-- Configure MSBuild to compile the updated files -->c:\
        <buildArgs>/noconsolelogger /p:Configuration=Debug /nologo</buildArgs>
        <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>

        <!--Call mstest to run the tests contained in the TestProject -->
        <executable>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe</executable>
        <!--testcontainer: points to the DLL that contains the tests -->
        <!--runconfig: points to solutions testrunconfig that is created by, list what test to run -->
        <!--resultsfile: normally the test run log is written to the uniquely named testresults directory  -->
        <!--                   this option causes a fixed name copy of the file to be written as well -->

    <!--Publishers will be done after the build has completed-->
        <publishDir><PATHOFYOURAPPLICATION>\\Sample Application 9091</publishDir>
          <file action="Merge" deleteAfterMerge="true">msbuild-results.xml</file>
          <file action="Merge" deleteAfterMerge="true"><PATHOFYOURAPPLICATION>\\SampleApplication\Web\bin\Debug\testResults.trx</file>
      <email from="" mailhost="" mailport="25" useSSL="FALSE" mailhostUsername="" includeDetails="TRUE" mailhostPassword="XXXX" >
          <user name="Abhishek" group="buildmaster" address="" />
          <user name="Devs" group="developers" address="" />
          <group name="developers">
          <group name="buildmaster">


Once we are done with the configurations we need to start the CruiseControl.Net Server. For starting the server open Services.msc -> CruiseControl.Net Server. Start this service.

As soon as you are done with that you are ready with your entire configuration to produce automated builds. Access the URL: http://localhost:8080/ViewFarmReport.aspx  and you will see a Project which you configured on this dashboard.

From here you can force build and can also check the status of various builds along with the exception details or the error details if any.

As I mentioned earlier you can also download CCTray from this page by clicking on the link “Download CCTray”. It will help one to see when the error occurred and by looking into it one gets immediately notified for the error in the check-in and can resolve it on the fly.

No comments:

Post a Comment