TeamCity 5.0 Help

Configuring VCS Triggers

VCS Build Triggers automatically start a new build each time TeamCity detects that updates have been checked into the Version Control System. When this option is enabled, TeamCity periodically (according to root's Changes Checking Interval) polls VCS roots of the build configuration for changes and triggers a build (puts it into the build queue) when matching changes are found.

Quiet Period Mode

If Quiet period mode is set for the trigger, the build will be triggered only after the specified time elapses since the commit. This can be used to ensure a build is not triggered in the middle of non-atomic checkins consisting of several VCS checkins.

Using Wildcards and Operators in VCS Triggers Rules

By default, a build with VCS trigger configured is triggered upon any change.

VCS trigger rules allow to specify the set of files which changes should trigger the build. You can add these rules manually in the text area, or use the UI option "Add new rule" to generate them.

There can be multiple rules, each starting on a new line. Each rule is ether an "include" (starts with "+") or an "exclude" (starts with "-"). For each file in a change the most specific rule is found (the rule matching the longest file path). The build is triggered if there is at least one file with a matching "include" rule or a file with no matching rules.

The general syntax for a single rule is:

+|-:[user=VCS_username;][root=VCS_root_name]:Ant_like_wildcard]

Where:

  • Ant_like_wildcard - A Wildcards to match the changed file path. Only "*" and "**" patterns are supported, "?" pattern is not supported. The file paths in the rule can be relative (resulting paths on the agent will be matched) or absolute (started with '/', VCS paths relative to VCS root are matched).

  • VCS_username - if specified, limits the rule only to the changes made by a user with corresponding VCS username.

  • VCS_root_name - if specified, limits the rule only to the changes from the corresponding VCS root.

When entering rules please note that as soon as you enter any "+" rule, TeamCity will remove the default "include all" setting. To include all the files, use "+:." rule.

An example with these build triggering rules:

+:. -:**.html -:user=techwriter;root=Internal SVN:/misc/doc/*.xml -:lib/**

In the above example,

  • the rule "-:**.html" excludes all .html files from triggering a build.

  • the rule "-:user=techwriter;root=Internal SVN:/misc/doc/*.xml" excludes builds being triggered by .xml files checked in by user "techwriter" to the misc/doc directory of the VCS root named Internal SVN (as defined in the VCS Settings). Note that the path is absolute (starts with "/"), thus the file path is matched from the VCS root.

  • the rule "-:lib/**" prevents the build from triggering by updates to the "lib" directory of the build sources (as it appears on the agent). Note that the path is relative, so all files placed into the directory (by processing VCS root checkout rules) will not cause the build to be triggered.

Last modified: 20 April 2023