Automating builds from subversion tags

风流意气都作罢 提交于 2019-12-05 00:07:22

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.

EDIT

I recently added a job on my hudson build server that listens for a google/gmail jabber chat. I can "promote" a "regular" build to a release build with this mechanism. I just set up a new job that does the steps necessary to promote/publish a private build into a release candidate.

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.

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.

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.)

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.

I'd also recommend Hudson for this. I was looking to do something similar, create a tag and have that kick off a build. Instead I opted to use this plugin for hudson:

http://wiki.hudson-ci.org/display/HUDSON/Release+Plugin

And use this to drive creation of the tag and an explicit release build.

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).

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!