Tuesday 19 January 2010

A simple solution to downloading matching instance files in CC.net

At Serverside we use Cruise Control .Net as our continuous build server. I have found it to be easy to use and it integrates with NAnt and NUnit really well. Today I hit upon a interesting problem in one of our builds: We needed a instance code line to be updated every time the base code line was updated. Where an instance is just a specific branded website of the base code. The instances are in the same repo, but in different "lines" of the repository, so we couldn't just update the whole trunk line. The way I solved it was that every time the CC.Net project is triggered, the first task that CC.Net runs is a svn update on the instance lines. I run svn in a exec task. The trick here is to remember to use the --username and --password arguments to make sure that you update with the right user. My final exec node looks something like:
<exec>
 <executable>svn</executable>
 <baseDirectory>instance trunk directory</baseDirectory>
 <buildArgs>update --username xxx --password yyy</buildArgs>
</exec>
simple as that. The only problem is that the build is not run when instance code is checked in. However it looks like I may have to re write the build script to get that to work correctly.

No comments: