Configuring Schedule Triggers

Skip to end of metadata
Go to start of metadata
You are viewing documentation of TeamCity 7.x, which is not the most recently released version of TeamCity. Please refer to the listing to choose another version.
Search

Searching TeamCity 7.x Documentation

Table of Contents

Scheduled trigger allows to set time when a build of the configuration will be run daily or weekly. Besides you can specify more complex time settings using cron-like expressions. This format provides more flexible scheduling options.

TeamCity uses Quartz for working with cron expressions.

Examples

  Each 2 hours at :30 Every day at 11:45PM Every Sunday at 1:00AM Every last day of month at 10:00AM and 10:00PM
Seconds 0 0 0 0
Minutes 30 45 0 0
Hours 0/2 23 1 10,22
Day-of-month * * ? L
Month * * * *
Day-of-week ? ? 1 ?
Year(Optional) * * * *

See also other examples.

Brief description of the cron format used

Cron expressions are comprised of six fields and one optional field separated with a white space. The fields are respectively described as follows:

Field Name Values Special Characters
Seconds 0-59 , - * /
Minutes 0-59 , - * /
Hours 0-23 , - * /
Day-of-month 1-31 , - * ? / L W
Month 1-12 of JAN-DEC , - * /
Day-of-week 1-7 or SUN-SAT , - * ? / L #
Year(Optional) empty, 1970-2099 , - * /

For the description of the special characters, please refer to Quartz CronTrigger Tutorial.

VCS Settings

You can restrict schedule trigger to start builds only if there are pending changes in your version control by selecting corresponding option.

To limit the changes that trigger the build, use 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 an "include" (starts with "+") or an "exclude" (starts with "-").

The general syntax for a single rule is:

Where:

  • Ant_like_wildcard - A wildcard 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.
  • VCS_comment_regexp - if specified, limits the rule only to the changes that contain specified text in VCS comment. Use Java Regular Expression pattern for matching text in a comment (see examples below).

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.

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.

Trigger Rules Example

Here,

  • "-:**.html" excludes all .html files from triggering a build.
  • "-: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.
  • "-: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)

Labels:

cron cron Delete
expression expression Delete
build build Delete
trigger trigger Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.