Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


Continuous Integration with CruiseControl.NET

Triggering Builds

If you provide the interval trigger without any parameters, you will get the default 60 seconds between the time the last integration ends and the next cycle begins. By default, the build fires only if something changes in the source repository. You can change the default settings this way:

<intervalTrigger seconds="30" buildCondition="ForceBuild"/>

This will cause the CCNet to cycle this project every 30 seconds and build every time regardless of any changes in the repository.

Let's consider a more complicated scenario. What if you want to build projects that are referencing a shared library and something changes inside? You can use another type of trigger, a project trigger, as in Listing 2.

<project name="WindowsCalculator">
    <intervalTrigger initialSeconds="0" />
    <projectTrigger project="Framework">                            1
  <sourcecontrol type="svn">
    <executable>C:\Program Files\Svn\bin\svn.exe</executable>
      <buildArgs>/p:Configuration=Release /verbosity:minimal</buildArgs>
        C:\Program Files\CruiseControl.NET\server

1 Project dependency trigger
Listing 2: Triggering one build with another project build.

We are performing an ordinary CI build every 30 seconds and, additionally, we are checking if a dependent project completed its build (#1). If it did, we fire the build for WindowsCalculator as well.

You can distribute your projects over more machines. CCNet lets you distribute your projects indirectly. This means you don't have a centralized server that is managing build processes but you can couple several CCNet instances. For example, if the Framework project is built on a separate machine, you can provide the additional attribute serverUri to your project trigger like this:

<projectTrigger serverUri="tcp://server:21234/CruiseManager.rem" project="Core">
    <innerTrigger type="intervalTrigger" seconds="30"/>

This way, one CCNet instance will ask another instance about the Framework build. Additionally, the innerTrigger element lets you define how often it happens. We decided it should poll the changes from another CCNet server every 30 seconds rather than the default 5 seconds, which might be too often for a distributed scenario.

What if you have a long-running build you want to perform once a day, possibly at night? For example, you may need to generate documentation from your source code. It takes a lot of time. It is not necessary to generate the documentation whenever the source code changes. You can use the schedule trigger to accomplish this. Let's define it:

<scheduleTrigger time="03:00" buildCondition="ForceBuild" />

In this case the build will fire every night at 3:00 AM.

You can limit the trigger further. Let's say you want this build to run once a week at night on Sundays. Here you are:

<scheduleTrigger time="03:00" buildCondition="ForceBuild">

Using triggers you can easily manipulate the build chain. But this chain has an end. When the build is done you have to pass on the feedback. You can do it with publishers.


As you can see, there is a lot to configure with CCNet. You will learn a lot about how the CI servers are working by manually configuring CCNet. You will have to use the CCNet documentation quite extensively to get it done the way you want it to work. And it will take a little time to bring it to the right level.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.