Continuous Integration with TeamCity and Git

Martin Kirsten's picture

VCS Root Settings
Having recently migrated our Version Control System from SVN to Git, we needed to update our continuous integration (CI) environment to use Git. CruiseControl.NET works excellently with SVN, but does not support Git. A quick search revealed that a community plugin for Git (available from github, of course ;) ) has been created for JetBrains' TeamCity. I jumped at the opportunity to test this setup.

What you will need:
1 - TeamCity (v4.0.2 was the latest when going to press)
2 - Git TeamCity plugin (make sure to get this commit; apparently it has been merged into the master branch)
3 - maven - needed to compile the plugin (latest version is 2.0.10)

Steps:
1 - Install TeamCity: pretty straight-forward, see this post for guidance. (Tip: make sure that both the TeamCity Web Server and TeamCity Build Agent Service services have been started - it may be necessary to run the TeamCity Build Agent Service under a local user account and not the local System account - this can be configured during install of TeamCity or after).
2 - Build the Git plugin using maven. (Tip: make sure that your environment variables are set up correctly!).
3 - Install the Git plugin:

  • package the plugin by following the steps outlined in file pkg in the Git plugin folder: create a folder gitAgent/lib in the folder target, copy all the .jar files (should only be Git-vcs.jar) to this folder, and then zip gitAgent to gitAgent.zip
  • deploy the plugin by following the steps outlined in file deploy in the Git plugin folder: copy gitAgent.zip to webappsROOTupdateplugins, and copy Git-vcs.jar to webappsROOTWEB-INFlib

5 - Configure your TeamCity project: I will not explain the basics of configuring a project in TeamCity (the process is very well documented in the TeamCity documentation; also see this post), but will only give details on how to configure the VCS Root to use Git.

You first need to create and configure a VCS Root. You will note that "Git" appears in the Type of VCS drop-down, this indicates that the plugin has been installed successfully. You will also need to configure the VCS Settings for your particular project; make sure to select Automatically on agent (if supported by VCS roots) from the VCS Checkout mode drop-down (see the screenshots for details).

That's it! Do a test build run, and witness the magic.

UPDATE 2009/04/07: As Peter correctly points out, you need git installed on the build machine; I used 1.6.1-preview20081227 (msysgit). If not using the default git install path (i.e. C:Program FilesGit or C:Program Files (x86)Git), make sure to update srcmainjavaorghivedbteamcitypluginGitConfiguration.java at line 87.

Trackback URL for this post:

http://www.knowledgetree.com/trackback/205

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

About  |  Blog  |  Careers  |  Support  |  Privacy  |  LegalCall: 1 877.900.0350

© Copyright 2010, KnowledgeTree, Inc. All rights reserved. KnowledgeTree and the KnowledgeTree logo are trademarks of KnowledgeTree, Inc.
All other trademarks are property of their respective owners.