Icon

You are viewing the documentation of TeamCity 2018.x, which is not the most recently released version of TeamCity.
View this page in the latest documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

 

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: typo

...

After the last change is detected, a quiet period can be configured to wait for some time without changes before the build is queued.

...

If triggering rules are specified (described below), they are applied to all the changes (including changes from snapshot dependencies) and only the changes matching the rules trigger the build chain.

...

Excerpt Include
Configuring Schedule Triggers
Configuring Schedule Triggers
nopaneltrue
Excerpt
Anchor
buildTriggerRules
buildTriggerRules

VCS Trigger Rules

If no trigger rules specified, a build is triggered upon any detected change displayed for the build configuration. You can affect the changes detected by changing the VCS root settings and specifying Checkout Rules.

To limit the changes that trigger the build, use the VCS trigger rules. You can add these rules manually in the text area (one per line), or use the Add new rule option to generate them.

Each rule is ether either an "include" (starts with "+") or an "exclude" (starts with "-").

General Syntax

The general syntax for a single rule is:

Code Block
+|-[:[user=VCS_username;][root=VCS_root_id;][comment=VCS_comment_regexp]]:Ant_like_wildcard

Where:

  • Ant_like_wildcard - A wildcard to match the changed file path. Only "*" and "**" patterns are supported, the "?" pattern is not supported. The file paths in the rule can be relative (not started with '/' or '\') to match resulting paths on the agent or absolute (started with '/') to match VCS paths relative to a VCS root. 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 "exclude" rules.
  • VCS_username- if specified, limits the rule only to the changes made by a user with the corresponding VCS username .
  • VCS_root_id - if specified, limits the rule only to the changes from the corresponding VCS root.
  • VCS_comment_regexp - if specified, limits the rule only to the changes that contain specified text in the VCS comment. Use the Java Regular Expression pattern for matching the text in a comment (see examples below). The rule matches if the comment text contains a matched text portion; to match the entire text, include the ^ and $ special characters.
Info

When specifying the rules, please note that as soon as you enter any "+" rule, TeamCity will change the implicit default from "include all" to "exclude all". To include all the files, use "+:." rule.

Also, rules are sorted according to path specificity. I.e. if you have an explicit inclusion rule for /some/path, and exclusion rule -:user=some_user:. for all paths, commits to the /some/path from some_user will be included unless you add a specific exclusion rule for this user and this path at once, like -:user=some_user:/some/path/**

Trigger Rules Examples

Code Block
+:.
-:**.html
-:user=techwriter;root=InternalSVN:/misc/doc/*.xml
-:lib/**
-:comment=minor:**
-:comment=^oops$:**
 
  • +:. includes all files
  • "-:**.html" excludes all .html files from triggering a build.
  • "-:user=techwriter;root=InternalSVN:/misc/doc/*.xml" excludes builds being triggered by .xml files checked in by the VCS 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.
  • "-: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.
  • "-:comment=minor:**" prevents the build from triggering, if the changes check in comment contains word "minor".
  • "-:comment=^oops$:**" no triggering if the comment consists of the only word "oops" (according to Java Regular Expression principles ^ and $ in pattern stand for string beginning and ending)

Excerpt Include
Configuring Finish Build Trigger
Configuring Finish Build Trigger
nopaneltrue

...