At our most recent .NET users group meeting, Joe Healy asked for a show of hands for those doing Continuous Integration. There were about 40 of us and (I'm pretty sure) no one raised their hand.
A few years back, I had a NAnt script that was scheduled to execute nightly (you could also call it manually via a classic ASP page). The script would grab the source from Subversion, build it, execute some SQL scripts to construct a fresh database, bcp in some data, and finally publish the Web application to the staging server. (Notice that I didn't mention anything about unit testing). This was the closest I ever got to Continuous Integration, and I was tempted to raise my hand.
Why I didn't do it...
I've thought about CI many times over the years, but I kept putting it off. The configuration challenge was always a bit daunting. A couple of months ago, I started to get excited again after watching the dnrTV episode on CI Factory. However, even with the simplification brought about by CI Factory, it didn't quite seem worth the effort. (I should punctuate that we are still a small shop operating in teams of 2 or 3).
I had mostly experimented with CruiseControl.NET in the past, and the configuration was more than I wanted to deal with.
I Value Simplicity.
Or as Ayende might say Zero Friction. I imagine that CC.NET might have been zero friction to use, if I had ever gotten past the setup. (I will readily admit a good deal of laziness here).
After Joe's admonition about not doing CI, I asked Google about my choices for CI in the .NET world and it reminded me of Draco.NET.
I installed Dract.NET, and I was happily doing CI within an hour.
How to configure Draco.NET
Specifically, I will step through how I set it up to work with Subversion 1.4.4 and NAnt 0.85.
- Download Draco Server 1.6.4 from here.
- The installer will create a service named "Draco.NET".
In order to have this service work properly with NAnt I had to run it under domain account. (At first I used Local System Account with Allow service to interact with desktop, but it reported a File Not Found when it attempted to call nant.exe.)
- Add the bin directory for NAnt to your path. Additionally, I copied the some assemblies from NAntContrib and MbUnit in the NAnt bin directory in order to access tasks for msbuild and MbUnit within my NAnt script.
- The install will create a directory at "C:\Program Files\Draco.NET Service" and place two config files in a subdirectory bin.
- The default Draco.exe.config is fine, but I recommend taking a look at it.
- The other file, Draco.builds.config, tells Draco what projects to monitor. It can point to many projects under diverse source control.
- I deleted all of the <build/> nodes expect for the one referencing Subversion. You will have one <build/> node for every project the server monitors.
- Inside the <build /> node:
<name /> is merely a unique name to identify the project.
<nant /> tells Draco to use NAnt to execute the build process, and points to your build file within the source that it checked out.
<svn /> tells Draco the repository that it will monitor for this build. You'll probably want to create a readonly account for Draco to use.
What Draco does
Aside from hating Harry Potter...
Draco will poll the repository in the build every 60 by default. If it finds any modifications since the last build, it will wait for the repository to be quiet for a designated amount of time (again 60 seconds by default). Quiet means no further commits during the period. After the repository been quiet, it will check out the source to a temp directory and then execute NAnt script.
At this point, it is really up to your NAnt script. Currently, mine is very simple. It calls msbuild to compile the solutions, and then calls MbUnit to execute the tests.
Monitoring the Build
Draco.NET has a client for monitoring the status of builds available here. I installed 1.6.4, and it did not add anything to my start menu.
It installed a help file to this location:
C:\Program Files\Draco.NET Client Tools\Draco.chm
And a monitoring app that runs in the systray here:
C:\Program Files\Draco.NET Client Tools\bin\DracoGui.exe
In addition to monitoring, you can:
- Start Build - which tells Draco to check the repository for modifications, but only starts the build if there has been a change.
- Force Start Build - which kicks off a build even if there no modifications.
Finally, there is an install for monitoring builds over the Web, but I haven't played with that yet.
08-12-2007 3:37 PM