Unstable Terrain

Software development in the real world

Configuring TeamCity for Subversion

with 2 comments

At work, we’ve just started using TeamCity as our continuous integration server. The app itself is very slick, but the documentation is spotty. There doesn’t seem to be a simple example of how to set up TeamCity 4.5.x with subversion anywhere on their site (or on the net either, although they’re probably hidden away inside nabble or something). Happily, I can remedy this.

Setting up a VCS Root

You’ll need to set up a new VCS root for each project. Let’s say we’re setting up SVN for a project called unstableterrain. Setting up the project itself is simple, so I’ll assume you’re up to the challenge.

For the sake of brevity, let’s imagine the subversion repository is set up like so:

root
  |---- trunk
  |---- branches
  |      |---- ...
  |      |---- v04.02.00b
  |      |---- v04.02.01b
  |      |---- v04.02.02b
  |      |---- v04.03.00b
  |      \---- ...
  \----tags
         |---- v04.02.00.1
         |---- v04.02.00.2
         |---- ...
         \---- v04.03.00.266

So, onto the instructions.

  1. Add a VCS root:
    • name = ‘unstableterrain via SVN’
    • type = Subversion
    • URL = http://my.svn.server:9001/svn/unstableterrain/
    • set your username and password accordingly (if your svn server allows anonymous checkouts and your build script doesn’t check anything in, then you can skip this entirely)
    • Labelling rules: Add trunk, and a rule for every branch you plan on using. This, unfortunately, is manual in the version I’m using (4.5) because wildcards don’t work. In this example, you’d enter
      +:trunk=>tags
      +:branches/v04.02.00b=>tags
      +:branches/v04.02.01b=>tags
      +:branches/v04.02.02b=>tags
      +:branches/v04.03.00b=>tags
      … you get the idea
    • Test the connection
    • Save; you’re done.

Attaching your VCS root to a project configuration

Say we’re setting up a project config called “unstableterrain v04.03.00 snapshot”. You want to check out this branch and run builds against it, incrementing the build label and tagging.

  1. Add general details
    • build number format = v04.03.00.{0}
    • Artifact paths: these map from the results of your build to directories under the artifacts node, e.g.:
      build/dist/*.war => dist
      build/emma/all/**/*.html => emma
      build/tmp/checkstyle/**/*.html => checkstyle
  2. Add VCS settings
    • Attach the existing VCS root you specified earler (i.e. ‘unstableterrain via SVN’)
    • Edit checkout rules on the VCS, since we want to tell SVN which branch to checkout for this configuration:
      +:branches/v04.03.00b/=>.
    • VCS checkout mode = automatically on agent
    • VCS Labelling mode = Successful only
    • VCS Labelling pattern = v04.03.00.%system.build.number%
    • Choose VCS roots to label: ‘unstableterrain via SVN’ VCS root
  3. Edit build runner
    • add your settings
  4. Build Triggering
    • add your settings
  5. Save

And that’s it.

Advertisements

Written by Trent

October 14, 2009 at 9:00 am

2 Responses

Subscribe to comments with RSS.

  1. I followed these instructions however I needed to use the following url in order for teamcity to find the pom.xml for my project:

    http://my.svn.server:9001/svn/unstableterrain/trunk

    drew

    April 16, 2010 at 12:20 pm

    • Hi Drew. Your problem implies that you don’t have correct checkout rules set.
      In my example, you would go to Version Control Settings, then

      1. change the vcs root back to /svn/unstableterrain/
      2. click ‘edit checkout rules’ and enter +:trunk/=>.

      This should do the trick.

      Trent

      April 16, 2010 at 1:42 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: