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/**
topics:
- compare-type: ANT
pattern: refactor-xy**
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
Build merge requests in gitlab and report results. Requires the Jenkins Gitlab MergeRequest Builder Plugin.
Parameters: |
|
---|
Example:
triggers:
- gitlab-merge-request:
cron: '* * * * *'
project-path: 'test/project'
Poll the SCM to determine if there has been a change.
Parameter: | the polling interval (cron syntax) |
---|
Example:
triggers:
- pollscm: "\*/15 * * * \*"
Trigger when the HTTP response from a URL changes. Requires the Jenkins URLTrigger Plugin.
Parameters: |
|
---|
Example:
triggers:
- pollurl:
cron: '* * * * *'
polling-node: 'label expression'
urls:
- url: 'http://example.com/url1'
proxy: false
timeout: 442
username: username
password: sekr3t
check-status: 202
check-etag: false
check-date: true
check-content:
- simple: true
- json:
- '$..author'
- '$.store..price'
- url: 'http://example.com/url2'
proxy: true
check-etag: true
check-content:
- simple: false
- xml:
- '//author'
- '/store//price'
- text:
- '\d+'
This trigger can be configured in the UI using the checkbox with the following text: ‘Build after other projects are built’.
Set up a trigger so that when some other projects finish building, a new build is scheduled for this project. This is convenient for running an extensive test after a build is complete, for example.
This configuration complements the “Build other projects” section in the “Post-build Actions” of an upstream project, but is preferable when you want to configure the downstream project.
Parameters: |
|
---|
Example:
triggers:
- reverse:
jobs: 'Fantastic-job'
result: 'failure'
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"