Wednesday, March 5, 2008

CruiseControl.NET - Build/Integration Server


We have been kept on disucssing about the regular Build/Integration. Lets see how it works. (Please ignore if already known). J

CruiseControl.NET - Is an Automated Continuous Integration server, implemented using the Microsoft .NET Framework.

Why Continuous Build/Intergration:

The practice of continuous integration represents a fundamental shift in the process of building software. Integrating continuously makes integration a part of the natural rhythm of coding. Continuous integration is about progressing steadily forward by taking small steps.

Integration should happen continuously, and continuously is more often than you might think. The frequency of integration will vary from project to project, from developer to developer, and from modification to modification. However, as a goal and a good Rule Of Thumb, developers should integrate their changes once every few hours and at least once per day.

Learning how to integrate so frequently requires practice and discipline and Deciding when to integrate is all about controlling risk. The longer that developers go without integrating, the greater the likelihood of conflicts and the larger the effort required to resolve those conflicts.

A successful integration is a measure of progress. It provides feedback that the new code runs correctly in the integration environment and successfully interoperates with the rest of the code base. Code sitting unintegrated in a developer's workspace simply does not exist. It is not part of the code base, it cannot be accessed by other developers or tested by the customer. Only when it has been successfully integrated is the benefit of the new code realised.

How Cruise Control works – To achieve Continuous Integration:

CruiseControl.NET (Here after CCNet) consists of a suite of applications, but at its core is the CruiseControl.NET Server which is an automated integration server.

· The Server automates the integration process by monitoring the Team's Source Control Repository directly.

· Every time a developer commits a new set of modifications, the server will automatically launch an integration build to validate the changes.

· When the build is complete, the server notifies (By email) the developer whether the changes that they committed integrated successfully or not.

Lets understand by below exapmple - What steps the CruiseControl.NET server goes through when running an integration on a project built using NAnt and checked into a Visual Source Safe (VSS) Source Control Server.


· CruiseControl.NET Server

· Project is configured with the Project Configuration Block in the Server's Configuration. (Will be discussed later)


1. The CruiseControl.NET Server is in place and started. Also a project is started according to a Project Configuration Block in the Server's Configuration.

2. CCNet Server checks the Source Code Repository for modifications that have occurred since the last build attempt.

1. When modifications are detected

1. CCNet labels the project with CCNETUNVERIFIEDxxx (xxx = date/time) (Visual Source Safe only, optionally)

2. CCNet gets the latest version of the source from the source control repository

3. CCNet starts the build by executing the tasks in the <tasks> section of the ccnet.config file. In this example, the build will execute the <nant> task to run the NAnt build file.

3. NAnt processes the build script specified by the <nant> element. The following steps make up one possible scenario.

1. NAnt runs VS.NET using either the <exec> task or the <solution> task. The <solution> task provides better reporting capability for later steps.

2. NAnt runs NUnit using the <nunit2> task or the <exec> task

3. NAnt runs FxCop using the <exec> task

4. CCNet receives the outcome of the NAnt execution (Success/Failed)

1. If the build was successful, CCNet replaces the CCNETUNVERIFIEDxxx label with the next sequential build number. (VSS only)

2. The XML output files are gathered from each step using the File Merge Task and output as an xml file in the log directory specified in the <logDir> element.

5. CCNet sends out email based on the <publishers><email> elements in ccnet.config (Optional).

1. If <group notification="change"> is set, then the individuals will only receive email if the status of the build changes (Success -> Fail, or Fail -> Success)

2. If <group notification="always"> is set, then the individuals will receive email for every build.

6. CCTray displays current status of the build in the client system tray. The user can use the "Launch web page" menu item to browse to the build status website.

7. Project Dashboard enables multiple continuous integration projects to be viewed.

Effectively, integration becomes as easy as checking in code. Using an automated integration server not only makes integration easy, it also guarantees that an integration build will happen. There is no danger of developers forgetting to validate their changes after checking in.

The CCNet Server offers several key features:

  • Integration with a variety of Source Control systems
  • Integration with other external tools, such as NAnt and Visual Studio
  • Can build multiple projects on one server
  • Remote management and reporting

Cruise Control Server - Quick Start

1. Check you have the Installation Prerequisites.

2. Download and Install. The Basic Installation page describes the types of kits that are available.

3. Add a Project Configuration Block to ccnet.config with the following sub blocks (you'll want at least these for most usages of CruiseControl.NET):

o SourceControl block - To specify where the project will be checked out from.

o Tasks block - To specify the steps required for the build.

o Publishers block - To define generated output, see Task Blocks.

4. Start the server running either:

o From the command line, see The Server Console Application

o As a windows service, See The Server Service Application.

I have tried my best to get a quick overview. There are lots of things to add. Please feel free to make the changes.


Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment