TeamCity 7.0 Help

VCS Labeling

TeamCity can optionally add a label into the version control system for the sources used for a particular build. This is useful if you need to collect all of the sources for a specific build in order to recreate it. You can choose to apply the VCS label for all builds or only for successful ones when configuring VCS Settings, or label a particular finished build manually.

To label a finished build manually:

  1. Open Changes tab of the build results page.

  2. Click Label this build sources link.

  3. In a dialog that appears, type the desired label name and select VCS roots to apply the label to.

The labeling process takes place after the build finish and doesn't affect the build status. If the label fails it will not change the build's status.

VCS labeling is supported for ClearCase, CVS, Perforce, StarTeam, Subversion, Mercurial, Git and Team Foundation Server.

SubversionLabelingRulesSubversion

Subversion VCS roots need additional configuration for VCS labeling to work. The Subversion need to be specified to define the SVN repository structure.

Labeling rules are specified as newline-delimited rules each of uses the following format:

TrunkOrBranchRepositoryPath => tagDirectoryRepositoryPath

The repository paths can be relative and absolute (starting from "/"). Absolute paths are resolved from the SVN repository root (the topmost directory you have in your repository), relative paths are resolved from the TeamCity VCS root.

When creating a label, the sources residing under TrunkOrBranchRepositoryPath will be put into the tagDirectoryRepositoryPath/tagName directory, where tagName is the name of the label as defined by the labeling pattern of the build configuration. If no sources match the TrunkOrBranchRepositoryPath, then no label will be created. The path tagDirectoryRepositoryPath should already exist in the repository. If tagDirectoryRepositoryPath directory already contains subdirectory with the current label name, the labeling process will fail, and the old tag directory won't be deleted or affected.

For example, there is a VCS root with the URL svn://address/root/project where svn://address/root is the repository root, and the repository has the structure:

-project --trunk --branch1 --branch2 --tags

In this case the labeling rules should be:

/project/trunk=>/project/tags /project/branch1=>/project/tags /project/branch2=>/project/tags

Variables substitution during labeling

You can use variables substitution both in labeling rules and in labeling pattern. For instance, in a VCS root used in different configurations, you can have a labeling rule like

/projects/%projectName%/trunk => /projects/%projectName%/tags

and this will require you to set Configuring Build Parameters %projectName% in build configuration settings.

By default, TeamCity will append label name to the end of the specified target path. If you want to have different directory structure and put label in the middle of the target path, you can use the following syntax:

/project/trunk => /tagged_configurations/%%system.build.label%%/project /modules/module1/trunk => /tagged_configurations/%%system.build.label%%/module1 /modules/module2/trunk => /tagged_configurations/%%system.build.label%%/module2

Thus, %\%system.build.label%\% will be replaced with the tag name (please note double %% sign at the beginning - it is important).

VCS Labeling Failure Notifications

TeamCity starts the VCSLabelingSupport process, when the build is finished. Thus VCS Labeling does not affect the build status, and therefore is not a standard Subscribing to Notifications. However, TeamCity allows notifying about labeling failure. If the labeling process failed due to some reason, TeamCity sends notification to all users, that have subscribed for Subscribing to Notifications of the current build configuration.

Last modified: 20 April 2023