Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Christopher Bennage

Our WPF book is now available!
follow @bennage on Twitter!
 


Continuous Integration with Draco.NET

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.

kick it on DotNetKicks.com


Comments

Sean Chambers said:

I'm suprised that more people aren't doing CI. I have been running a CruiseControl server at work and at home. The one at work is monitoring about 5 projects. The one at home is only monitoring one.

After using CI for the last 6 months, I honestly don't know what I would do without it now. It has helped me in finding bugs long before they came a problem and is a very important tool to me.

You are correct in saying the configuration in CC.Net is a little daunting. I wrote a brief CodeProject awhile ago that goes over the basics of a CC.Net configuration here:

http://www.codeproject.com/useritems/Continuous_Integration.asp

It just covers the tools I use, along with the basic idea of a CI server. Hope that helps someone out!

Sean

# August 12, 2007 4:18 PM

Derik Whittaker said:

Congrats on getting your first CI environment up and running.  Let the good times roll.

Now that you have this, the biggest hurdle is making sure ALL your tests pass EVERY time.

# August 12, 2007 9:21 PM

Slava Imeshev said:

> The configuration challenge was always a bit daunting.

Christopher,

Our Parabuild at http://www.viewtier.com/parabuild.htm may be worth a look. It takes less than five minutes to set up and about ten minutes to the first build.

Here is a demo that shows how to set up Continuous Integration for NAnt:

http://www.viewtier.com/support/demo/continuous_integration_for_dotnet_and_nant_flash.htm

Regards,

Slava Imeshev

# August 12, 2007 9:23 PM

Max Pool said:

Congrats Chris on your CI !

Even though, I have used CI for about 3 years now, I have always used Draco.NET for the 'zero friction'.  It is way easier to configure than CC.NET, let alone TFS.

I would echo that if you are new to CI, please check out Draco.NET as it will simplify the learning curve.

# August 13, 2007 11:11 AM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# August 13, 2007 6:22 PM

Morgan said:

one thing that always eludes me regarding automated unit tests is doing so for data driven applications. I always see math examples of unit tests (test that Multiply(3,5) = 15), which are uesless to me. How do you write a test that creates a new row in your database and confirms all the data was there?

also, what is bcp?

great article. it may inspire me to get into CC. I am also lazy and a one many army for my project so the overhead is scary. thanks!

# August 23, 2007 7:52 AM

Christopher Bennage said:

@Morgan - BCP is the bulk copy utility for SQL Server, allowing you to export/import data in mass.

Regarding the different types of tests, they are out there.  We don't call them "unit" tests if they talk to something like a database.  Usually, we call them integration tests.  I will post some examples later.

# August 23, 2007 11:39 AM

Morgan said:

You know what would be great? A sample application for CI/Unit tests.. Proper n-tier with full automated unit tests, integration tests, and CI config. Like a simple CRM or something.  I love learning by example.

I haven't looked yet but maybe there is something out there already...

# August 23, 2007 3:18 PM

This is why I haven’t been going to user group meetings « The Pursuit of a Life said:

Pingback from  This is why I haven&#8217;t been going to user group meetings &laquo; The Pursuit of a Life

# January 3, 2008 10:46 AM

Christopher Bennage said:

The last two Octobers, I took a moment to reflect on the development tools I was using. It&#39;s interesting

# January 25, 2008 9:58 AM

Community Blogs said:

The last two Octobers, I took a moment to reflect on the development tools I was using. It&#39;s interesting

# January 25, 2008 10:32 AM

About Christopher Bennage

Christopher is a software developer and consultant at Blue Spire Consulting, a company he co-founded with Rob Eisenberg in 2006. He is a Christian, a marginal musician, and an armchair philosopher. His interests include programming, liberal education, science, truth, beauty, and a number of deceased British authors (C. S. Lewis, G. K. Chesterton, and most recently Owen Barfield.) He lives in Tallahassee, FL with his wife and three children and still prefers to play as the Night Elves in WarCraft 3. Check out Devlicio.us!

Our Sponsors

Proudly Partnered With