views:

2189

answers:

7

I'm trying to automate the build process for engineering group. As part of that automation, I'm trying to get to a point where the act of applying a specific tag that adheres to a pattern will kick off an automated process that will do the following:

  • Check out source code
  • Create a build script from a template
  • Build the project

I'm pretty certain I could do this with a post-hook in subversion, but I'm trying to figure out a way to do this with something other than a subversion hook.

  • Would it make sense to monitor the tags directory in the subversion repository to kick off my workflow?
  • Are there any decent tools that help with this (.NET would be great if possible).
  • Am I better off just writing an engine to do this?

My preferences:

  • Existing product that does all or part of this
  • If development work needs to occur, .NET is preferable
  • Works with Windows (we've got a Linux based repo, but builds all occur on windows)
+2  A: 

A commercial product has been advertised on this site for exactly this purpose!

http://www.finalbuilder.com/Default.aspx?tabid=314

You may need to add a post-hook to SVN to trigger the build start unless you want it to be run a time schedule.

VBNight
+1  A: 

I'm using NAnt (and NAntContrib) for automated builds. It automatically checks a subversion repository for changes and (if there are any) gets the latest source code version and starts the build.

I'm not sure if the existing tasks allow to do exactly what you want, but maybe you could use it as a start and if required, extend it with tasks for your special needs (It's developed with .NET).

M4N
+3  A: 

CruiseControl.Net can easily automate automatic builds from subversion repositories.

It can monitor the repository (Svn and several other types) and start automatic builds using a variety of tools. (NAnt, MSBuild, etc.)

Bert Huijben
+4  A: 

Sounds like you're after a continuous integration build engine something like CruiseControl or Hudson (hudson's written in java but is VERY easy to use in windows).

Now you could fudge your build scripts for these tools to watch the tags directory, but that would be a little against the grain as they're intended to watch a specific location and build the project at that location. If you watch the whole tags directory, you could easily end up with all the tags would be checked out on the build machine and you'd need a top level script to decide which tag to build.

For what you want, a build engine can watch a specific location (say '/branches/release'). If you then merge into that branch, Hudson will automatically build the project, archive the artifacts and create a tag for you if it was all successful (see the Subversion Tagging Plugin).

I don't like doing this sort of thing from a post-commit hook because it makes the commit phase take too long. However, TeamCity is a source control system that has a feature that does exactly that without holding you up whilst it commits.

I'd recommend Hudson for this.

Jim T
Yeah, I think you see what I'm after which is really automating the way the release mechanic works. If I simply the model, it means that all dev does is tag the release and the rest is workflow automation. I'll take a look at Hudson. I've used CC.NET and it's really not build to do this work.
Ajaxx
+1  A: 

Like the other guys said, you want a continuous integration server (CruiseControl, CruiseControl.Net, Hudson, etc). While you could work on your build script and commit hooks to do the functionality you described, in the end you'll find you re-invented the wheel (Continuous Integration Server). No need to, there are freely available solutions for just this purpose.

The process will work a bit different than you described above. The build server will:

  1. Detect a new commit
  2. Checkout your source code
  3. Run your build script
  4. Tag on successful build

The commit triggers the process and creates the tag rather than the tag triggering the process. The server does this my monitoring the svn repository rather than a commit hook.

Check out CruiseControl.Net's documentation on this subject, specifically the options tagOnSuccess and tagBaseUrl. Hudson and CruiseControl should have similar options.

http://confluence.public.thoughtworks.org/display/CCNET/Subversion+Source+Control+Block

mcdon
+3  A: 

I've done this using Hudson. In the regular subversion checkout slot I have a checkout for the trunk:

http://dryad.googlecode.com/svn/trunk/dryad

Then as the first build action, I have an "execute shell" and in that shell use a svn switch to change to the latest tag in the repository:

svn switch http://dryad.googlecode.com/svn/tags/'svn ls http://dryad.googlecode.com/svn/tags | tail -n 1' dryad

The next build step is a maven 'clean install' command that starts the build using the code from the tagged version.

I haven't figured out yet how to get Hudson to start with a latest tagged version rather than having to do the switch, but the switch works. You can then have the trigger be when the tag directory is updated.

It's automated... a bit of a kludge, but it works...

the switch should include a backtick for the second svn command but had to use ' because the backtick didn't show up here.

ksclarke
+1  A: 

I like hudson - EASY to set up and works out of the box with SVN.

You can configure it to build on every commit.

I downloaded it and got started building with it within a day. It has gone through a lot of tweaks, but I would recommend it to anyone.

I have also used cruise control but am not as happy with that. I don't have any specific reasons other than cross-platform issue.

Tim