My Blahg

April 21, 2008

CruiseControl.NET and multiple build configurations: Part 1 – Introduction

Filed under: c#, Continuous Integration/CruiseControl.NET, dotnet, NAnt — treyhutcheson @ 3:28 pm

[More Posts On This Topic]

I recently created a post regarding handling debug or release configurations within nant scripts. This post will extend the problem to CruiseControl.NET.

Question: how does one manage automated builds within CruiseControl.NET where multiple configurations are present?

I’ve been considering this problem for a couple of years now, and a solution that I liked has evaded me, until now.

My first thought was to have separate projects configured, each pointing to the same project, but with its own configuration. I even implemented this approach, once, and it lasted until my first test pass. One project performed a DEBUG build, while another configuration performed a RELEASE build. When I committed a change to the repository, ccnet dutifully observed the change and kicked off both builds. But as both builds shared the same physical location on disk, both build scripts attempted to create and delete temporary build folders, resulting in file locking errors.

I considered having completely separate folders on disk for each project configuration, both pointing to the same module in the CVS repository, but soon dismissed the idea. It seemed like a waste of both disk space and cycles. Disk space is cheap, and so are processor cycles(my builds are for the most part very quick), but I didn’t want to follow this same duplicated-folder pattern for each of my projects. After all, my build environment is presently handling about 10 separate projects. Duplicating each project for DEBUG or RELEASE configurations would be a shameful waste.

I’ve played around with the idea of creating a custom ccnet plugin, but the documentation is quite poor and I didn’t have the luxury of devoting time or concentration to the issue. That is, until very recently.

I reviewed the public ccnet docs again, researching plugins. I could create a plugin hosted by the server process, or I could create a plugin for the dashboard. I chose to implement a dashboard plugin because ultimately I wanted the ability for the user to choose a configuration from the dashboard itself, and to kick off a build after selecting the desired configuration.

My first thought of a dashboard plugin was to modify the main farm page of the dashboard; the page with the project grid that allows users to force builds, or stop active builds. I wanted to add a new column to the table with a drop-down box that contained the available configurations. The user would choose the configuration, and click the Force button to perform a specific-configuration build.

It took me a while to come to grips with creating a dashboard plugin. The documentation is sparse, and the object model difficult to understand, specifically the model of obtaining object references at runtime.

My first attempt ultimately proved be a failure, but it wasn’t completely unfruitful. I learned a bit of how to use the Velocity system to generate views, and how object references are injected into your plugin’s constructor at runtime. I also uncovered a bug within the ccnet dashboard itself.

Fortunately, this bit of code-spelunking and discovery didn’t take very long. Overall I believe I spent maybe 10 hours of clock-time to end up with a compiled and deployed solution that meets my needs. I will document my discoveries, as well as the final solution, over the coming days. I believe blogging about this process will prove interesting, as I predict it will take more time to sufficiently cover all of the topics than it took to create a final solution in the first place.

1 Comment »

  1. Hi treyhutcheson,

    I am using ccnet service for building our .net applications for a while. Now I am in the process of adding deployment option from ccnet dashboard. so that the user can select either to build, Deploy to dev, Test, Production. I couldn’t find any proper guide to achieve the same. But after seeing your post.. I have a feeling that you ahve already something similar to it few years back itself. Could you please share your code on how you have created a dropdown to meet your needs. Thanks much for your post.. Its really what I was looking for searching for last 4 days.

    Thanks,
    Arul

    Comment by Arul — March 16, 2010 @ 7:35 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.