Automating builds from subversion tags

2019-04-19 13:23发布

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)

8条回答
乱世女痞
2楼-- · 2019-04-19 13:24

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.

查看更多
乱世女痞
3楼-- · 2019-04-19 13:24

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

查看更多
beautiful°
4楼-- · 2019-04-19 13:31

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.

查看更多
在下西门庆
5楼-- · 2019-04-19 13:36

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

查看更多
手持菜刀,她持情操
6楼-- · 2019-04-19 13:37

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

查看更多
Evening l夕情丶
7楼-- · 2019-04-19 13:38

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.

查看更多
登录 后发表回答