Configuring Schedule Triggers
The Schedule Trigger allows you to set the time when a build of the configuration will be run. The Builds Schedule page of the current project settings displays the configured build times. More than one Schedule trigger can be added to a build configuration.
Triggering Conditions
The settings in this section define time and other conditions for automatic build triggering. You can schedule a recurring build or set a specific date and time for it.
Date and Time
In addition to triggering builds daily or weekly at a specified time for a particular time zone, you can specify advanced time settings using cron-like expressions. This format provides more flexible scheduling options.
TeamCity uses Quartz for working with cron expressions. See the examples below or consider using the CronMaker utility to generate expressions based on Quartz cron format.
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 Changes VCS Settings
You can restrict schedule trigger to start builds only if there are pending changes in your version control by selecting the corresponding option. The Trigger only if there are pending changes option considers newly detected pending changes only: if there were pending changes before the trigger was created, the build is not triggered.
Build Changes
The Schedule Trigger can watch a build in a different build configuration and trigger a build if the watched build changes.
In the Build Changes section, select the corresponding box and specify the build configuration and the type of build to watch: last successful build, last pinned build, last finished build, or the last finished build with a specified tag.
TeamCity can promote the watched build if there is a dependency (snapshot or artifact) on its build configuration.
Additional Options
Enforce Clean Checkout
It is possible to force TeamCity to clean all files in the checkout directory before a build. This option can also be applied to snapshot dependencies. In this case, all the builds of the build chain will be forced to use clean checkout. The option also enables rebuilding all dependencies (unless custom dependencies are provided via the custom build dialog or the schedule trigger promotes a build).
Trigger Build on All Enabled and Compatible Agents
Build Queue Optimization Settings
By default, TeamCity optimizes the build queue: already queued build can be replaced with an already started build or a more recent queued build. To disable the default behavior, uncheck the box.
The branch filter in the Schedule Trigger works as follows:
if the option trigger build only if there are pending changes is turned ON, then the trigger will add a build to the queue for all branches matched by the trigger branch filter where pending changes exist
if trigger build only if there are pending changes is turned OFF, then the trigger will add a build to the queue for all branches matched by the trigger branch filter regardless of presence of pending changes there
Trigger Rules and Branch Filter Combined
Trigger rules and branch filter are combined by AND, which means that the build is triggered only when both conditions are satisfied.
For example, if you specify a comment text in the trigger rules field and provide the branch specification, the build will be triggered only if a commit has the special text and is also in a branch matched by branch filter.