Triggers define what causes a Jenkins job to start building.
Macro: | trigger |
---|---|
Entry Point: | jenkins_jobs.triggers |
Example:
job:
name: test_job
triggers:
- timed: '@daily'
Configure jobB to monitor jobA build result. A build is scheduled if there is a new build result that matches your criteria (unstable, failure, ...). Requires the Jenkins BuildResultTrigger Plugin.
Parameters: |
|
---|
Example:
triggers:
- build-result:
combine: true
cron: '* * * * *'
groups:
- jobs:
- foo
- example
results:
- unstable
- jobs:
- foo2
results:
- not-built
- aborted
Trigger on a Gerrit event. Requires the Jenkins Gerrit Trigger Plugin version >= 2.6.0.
Parameters: |
|
---|
You may select one or more Gerrit events upon which to trigger. You must also supply at least one project and branch, optionally more. If you select the comment-added trigger, you should also indicate which approval category and value you want to trigger the job.
Until version 0.4.0 of Jenkins Job Builder, camelCase keys were used to configure Gerrit Trigger Plugin, instead of hyphenated-keys. While still supported, camedCase keys are deprecated and should not be used.
Example:
triggers:
- gerrit:
trigger-on-comment-added-event: true
trigger-approval-category: 'APRV'
trigger-approval-value: 1
projects:
- project-compare-type: 'PLAIN'
project-pattern: 'test-project'
branches:
- branch-compare-type: 'PLAIN'
branch-pattern: 'master'
- branch-compare-type: 'PLAIN'
branch-pattern: 'stable'
file-paths:
- compare-type: ANT
pattern: subdirectory/**
skip-vote:
successful: true
failed: true
unstable: true
notbuilt: true
silent: false
escape-quotes: false
no-name-and-email: false
dynamic-trigger-enabled: true
dynamic-trigger-url: http://myhost/mytrigger
trigger-for-unreviewed-patches: true
server-name: my-server
Trigger a job when github repository is pushed to. Requires the Jenkins GitHub Plugin.
Example:
triggers:
- github
Build pull requests in github and report results. Requires the Jenkins GitHub Pull Request Builder Plugin.
Parameters: |
|
---|
Example:
triggers:
- github-pull-request:
admin-list:
- user1
- user2
white-list:
- user3
- user4
org-list:
- org1
- org2
cron: '* * * * *'
trigger-phrase: 'retest this please'
only-trigger-phrase: true
github-hooks: true
permit-all: false
auto-close-on-fail: false
Poll the SCM to determine if there has been a change.
Parameter: | the polling interval (cron syntax) |
---|
Example:
triggers:
- pollscm: "\*/15 * * * \*"
Triggers the job using shell or batch script. Requires the Jenkins ScriptTrigger Plugin.
Parameters: |
|
---|
Example:
triggers:
- script:
script: 'exit 0'
cron: 'H/15 * * * *'
enable-concurrent: False
label: master
exit-code: 0
Trigger builds at certain times.
Parameter: | when to run the job (cron syntax) |
---|
Example:
triggers:
- timed: "@midnight"