R – Automated builds of branches with SVN

build-automationcontinuous integrationcruisecontrol.netnantsvn

What I'm looking to do is have CI and an automated build for all of my branches in a repository. I'd like each build of these web apps to have it's own project and be placed as a virtual directory (or equivalent) on a branches site. This would be great to be able to create a new branch and have it start the continuous integration and build process automatically. Adding a new virtual directory in IIS isn't a big deal, I'm ok with doing this if the rest just puts itself in place.

For Example:

http://branch.domain.com/branch101/

http://branch.domain.com/otherBranchName/

Currently, I'm using SVN, Nant and CruiseControl.Net, but I'm open another continuous integration server or build scripting if the situation demands it.

Best Answer

This can be done, but alot of it is going to depend on your build scripts. If you tell cc.net to monitor the top level svn folder so for example have you project monitor:

http://myserver.com/svn/project rather than http://myserver.com/svn/project/trunk. If any changes are seen in http://myserver.com/svn/project it will kick off a build.

Now, it is up to your build script to determine what source is out of date or if there is a new branch to build. The build script would create a new VDir for any new branches.

Another option would be to have a cc.net project that was designed to do nothing other than add new projects to your cc.net. (Call it BranchBuilder project) I would leverage the pre-processor in cc.net and have a top level .config file that just included the project for trunk and each branch. The branch builder project would monitory the root path on svn. If it saw any changes it would look to see if there were any new branches since the last build. If there was one, it could create a ccnet-branchname.config file for that branch, create the vdir and then update the ccnet.config root file with an additional include.

After the ccnet config has been update cc.net will recognize the config file has been modified and reload the config adding your new branch project. That branch project would start running and build your new branch.