Click here to Skip to main content
15,392,679 members
Articles / Operating Systems / Windows
Tip/Trick
Posted 5 Nov 2014

Tagged as

Stats

11.9K views
2 bookmarked

Allow CruiseControl.NET to be Self Updating

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
5 Nov 2014CPOL4 min read
How to allow CruiseControl.NET to be self updating

Introduction

If you use CruiseControl.NET as your continuous integration (CI) server alongside your build process, then you can extend this process even further by allowing changes to CruiseControl.NET itself to be automatically updated through CruiseControl.NET. Yes, that's right. CruiseControl.NET can update itself.

When you want to add / edit / delete a project to your CruiseControl.NET dashboard, you need to update the config file ccnet.config. This file resides on your CI server as part of CruiseControl.NET. By default, amending this config file would entail remoting onto your CI server, locating the config file and updating the config file.

In this tip, I will show you how you can update CruiseControl.NET by using CruiseControl.NET itself, and all from the comfort of your local development PC.

Background

It is assumed that the reader is familiar with continuous integration and CruiseControl.NET.

In this tip, I use the version control system Subversion (SVN) but the same process can be applied irrespective of the version control system you use.

Create a New SVN Repository

The first thing you need to do is to create a new repository in SVN. The repository will be used to store just a single file so there is no need to create the branches and tags folders with your repository. As the only file contained within the repository is called ccnet.config, then this is what I have named my own SVN repository.

visual subversion

Add the file ccnet.config to your newly created repository. You will find this file in your CruiseControl.NET\server installation folder on your CI server. Once the file has been added to SVN, you can delete the original file from CruiseControl.NET\server. Deleting this file also ensures that your process is picking up the correct file.

Create a new folder on the CI server. This is where the file ccnet.config will get checked out to. A good place to create this folder will be at the same folder level as your other SVN checkout folders.

In my own case, I created a folder called ccnet.config on the CI folder at the same level as all my other CI folders (underneath a top level folder called C:\dev). When you have created the folder, perform an SVN update to bring down the latest version of the file.

subversion

subversion

Update the Location of ccnet.config

We have added the file ccnet.config to SVN in its own repository. We now need to tell CruiseControl.NET where to find this file ccnet.config now that we have added it to SVN and deleted it from its original location.

Depending on whether you run CruiseControl.NET from the web dashboard or as a service, then you need to update either ccnet.exe.config and / or ccservice.exe.config. To be on the safe side, it is a good idea to update both. Open the file(s) and look for the following key in the appSettings section.

XML
<add key="ccnet.config" value="ccnet.config"/>

Change this value to point to the location you created earlier, i.e., the folder where CruiseControl.NET will check the file out to. In my case, I have changed the value as follows:

XML
<add key="ccnet.config" value="c:\dev\ccnet.config\ccnet.config"/>

Create a New CruiseControl.NET Project

Up to this point, we have created a new SVN repository to store the file ccnet.config and updated the CruiseControl.NET config files so that it knows where to find the file. We have created a folder on our CI server to check the file out to, and got the latest version. Now we need to create a new CruiseControl.NET project that will allow developers to update the file.

On your local development PC, create a folder for the new repository and get the latest version of the file, and edit it accordingly. Here is the XML syntax from my own ccnet.config for updating ccnet.config.

XML
<project name="Update CCNET Config">
    <triggers>
        <intervalTrigger
                name="continuous"
                seconds="600"
                buildCondition="IfModificationExists"
                initialSeconds="5"/>
    </triggers>

    <externalLinks>
        <externalLink name="SVN Repository" url="https://subversion/svn/ccnet.config//" />
    </externalLinks>

    <sourcecontrol type="svn">
        <trunkUrl>https://subversion/svn/ccnet.config/</trunkUrl>
        <executable>C:\dev\tools\Subversion\bin\svn.exe</executable>
        <autoGetSource>true</autoGetSource>
        <workingDirectory>C:\dev\ccnet.config</workingDirectory>
        <timeout units="seconds">300</timeout>
    </sourcecontrol>
</project>

When you check the file ccnet.config back into SVN, it will automatically update your CruiseControl.NET web dashboard after its next run. So, you have successfully updated CruiseControl.NET from the comfort of your local development PC.

Summary

This tip has shown how you can automatically update CruiseControl.NET using CruiseControl.NET itself. This is an extremely simple yet powerful feature of CruiseControl.NET. It allows the developer to update their CI projects without requiring access to the CI server to do so (beyond the initial configuration). Feel free to leave a comment if you would like me to further elaborate on anything within this tip.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Dominic Burford
Technical Lead Gold-Vision CRM
United Kingdom United Kingdom
I am a professional software engineer and technical architect with over twenty years commercial development experience with a strong focus on the design and development of web and mobile applications.

I have experience of architecting scalable, distributed, high volume web applications that are accessible from multiple devices due to their responsive web design, including architecting enterprise service-oriented solutions. I have also developed enterprise mobile applications using Xamarin and Telerik Platform.

I have extensive experience using .NET, ASP.NET, Windows and Web Services, WCF, SQL Server, LINQ and other Microsoft technologies. I am also familiar with HTML, Bootstrap, Javascript (inc. JQuery and Node.js), CSS, XML, JSON, Apache Cordova, KendoUI and many other web and mobile related technologies.

I am enthusiastic about Continuous Integration, Continuous Delivery and Application Life-cycle Management having configured such environments using CruiseControl.NET, TeamCity and Team Foundation Services. I enjoy working in Agile and Test Driven Development (TDD) environments.

Outside of work I have two beautiful daughters. I am also an avid cyclist who enjoys reading, listening to music and travelling.

Comments and Discussions

 
GeneralGood article Pin
scottb15-Nov-14 22:54
Memberscottb15-Nov-14 22:54 
GeneralRe: Good article Pin
Dominic Burford5-Nov-14 23:10
professionalDominic Burford5-Nov-14 23:10 
GeneralRe: Good article Pin
scottb16-Nov-14 10:58
Memberscottb16-Nov-14 10:58 
GeneralRe: Good article Pin
Dominic Burford6-Nov-14 21:35
professionalDominic Burford6-Nov-14 21:35 
GeneralRe: Good article Pin
Dominic Burford5-Nov-14 23:19
professionalDominic Burford5-Nov-14 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.