views:

492

answers:

4

Hey dudes,

my manager has asked me to setup build automation for our projects. I have decided to use CruiseControl.Net as our continuous integration server as some other team members have a little experience with it, I have none - which is why I am happy to undertake this task.

We are using Subversion as our repository and the ultimate goal is to instantiate a build each time a project is tagged. So for example:

Adding a folder to svn://svn/tags/ProjectX/ such as svn://svn/tags/ProjectX/JulyCheckPoint should checkout the newly added tag (svn://svn/tags/ProjectX/JulyCheckPoint) to a local directory (D:\temp\tags\ProjectX\JulyCheckPoint) and run a nant file (D:\temp\tags\ProjectX\JulyCheckPoint\nant.build)

I know CruiseControl is able to monitor svn://svn/tags/ProjectX/ for changes, but I am unsure as to how I am going to checkout the latest tag to the build server's local disk and run the nant.build within if I don't know the the name of the most recent tag. I have done a bit of googling and believe that svn post-commit hooks may be something I should look into.

I hope all that makes sense, please let me know if you require further details/clarification. Any guidance/advice would be greatly appreciated.

Cheers.

A: 

the only way that I think that you can do this is to use svn:externals I think and setup a repository pointed at your tag.

svn propget svn:externals blah

and then do a checkout against that e.g svn checkout http://svn/repos/blah

In CruiseControl.NET put

<checkExternals>True</checkExternals>
<checkExternalsRecursive>True</checkExternalsRecursive>

in your config for that project

AutomatedTester
+2  A: 

Since you know how to monitor /svn/tags/ProjectX/ for changes, you can have it trigger a nant script. This script can execute commands against svn (see svn tasks in http://nantcontrib.sourceforge.net/release/0.85/help/tasks/index.html) to checkout the latest folder in /svn/tags/ProjectX/. From here you can use this nant script to call the nant script in checked out folder using the nant task.

acloutier
+1  A: 

This doesn't answer your question but I am curious about why you are choosing to build from tags rather than HEAD?

Typically continuous integration is used to build your project code every time changes are made to your source code repository so that problems are caught early.

I really like this article by Martin Fowler. It helped me a lot when I started using continuous integration.

MikeD
Thanks, I'll definitely take a look at that article. The next step I had in mind is be to implement nightly builds off the trunk (for the purpose you mention). Eventually, by building from tags, I want the build manager/developer who commits the tag to be given an .msi installation package containing the tagged project (looking into WiX). This way, any milestones that we reach can be built into a release installation by simply tagging the particular build. Are their any downsides to this that I've overlooked?
Boris
This sounds like a reasonable request but it doesn't really fit with the way that CC.Net works.In this case I would suggest having a second CC.Net project called release build which is run by administrators. This build would create the MSI and then tag the trunk. If modifications are required to the tagged code you can then branch and create a new CC.Net project to build from that branch.This is a very simplistic overview but hopefully will give you some ideas to get you started.
MikeD
A: 

Appreciate all the assistance dudes. I decided to give acloutier's suggestions a shot and made static nant files for each project, these nant files always sit on the build server.

CruiseControl.Net (setup on the build server) monitors the tags repository for each project and fires the appropriate static nant file. This nant file then runs some C# code that determines the name of the last added folder in the svn://svn/tags/ProjectX/ location.

Knowing the name of the last added folder allows me to svn-checkout the most recently tagged project under svn://svn/tags/ProjectX/ to a local location and run the nant file within the project.

If anyone requires any code snippets or clarification I'll gladly provide them when I get into work. Thanks for the help!

Boris
Hi Boris, can you explain or maybe show snippets on how you got this working? thank you!
AbeP