Automatically Adding Projects To CruiseControl.NET

posted on 2005-06-04 at 01:02:56 by Joel Ross

I recently set up a build server for my personal projects that includes CruiseControl.Net, Vault, and Dragnet. I'll be putting my blogging tool on there, as well as a few other things I have been putting together.

Anyway, one of the pains of setting up a continuous integration server is adding new projects. Most of the time, I have to TS into the server and change the ccnet.config file to include the new project and I usually end up leaving the file checked out on the build server, and never check it in. That means I never get the latest version under source control. I know - I should just check it in, but I don't.

I also don't typically have a nice editor on my build server to manage the editing of the config file. Notepad is nice, but VS.Net is better! So, my idea was to create a project in CruiseControl.NET that would monitor the ccnet.config file, and reload it if the file changes. Thus, I can change how a project is watched, add projects, or remove projects.

First, I configured CCNet to use a ccnet.config file in my source control tool. I put it in the $/BuildProcess folder. The first project I added was my build process project. It watches the $/BuildProcess folder and when something is changed, it calls my build file. Here's the build file contents:

<project name="BuildProcess" default="Go">
 <target name="Go">
  <exec basedir="." program="vault.exe" commandline="GET $/BuildProcess/ccnet.config -host [host] -username admin -password [pwd] -repository [Repository] -destpath C:\Source\BuildProcess\"/>
 </target>
</project>

Basically, all I do is get the latest version of the ccnet.config file. The CCService reloads this file and you have any updates you added, so if you add a project, you can have it start being monitored remotely!

One word of caution: If you screw up the config file, you're done. You'll have to go onto the build server and fix the problem there, since CruiseControl.NET can't load it's config file.

Categories: Development