| JENKINS-JOBS(1) | Jenkins Job Builder | JENKINS-JOBS(1) |
jenkins-jobs - Jenkins Job Builder Documentation
Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML or JSON format and uses them to configure Jenkins. You can keep your job descriptions in human readable text format in a version control system to make changes and auditing easier. It also has a flexible template system, so creating many similarly configured jobs is easy.
To install:
$ pip install --user jenkins-job-builder
Online documentation:
Bug report:
Repository:
Cloning:
git clone https://opendev.org/jjb/jenkins-job-builder.git
Install pre-commit from https://pre-commit.com/#intro in order to run some minimal testing on your commits.
A virtual environment is recommended for development. For example, Jenkins Job Builder may be installed from the top level directory:
$ virtualenv .venv $ source .venv/bin/activate $ pip install -r test-requirements.txt -e .
Patches are submitted via Gerrit at:
Please do not submit GitHub pull requests, they will be automatically closed.
Mailing list:
IRC:
More details on how you can contribute is available on our wiki at:
We ask that all code submissions be pep8 and pyflakes clean. The easiest way to do that is to run tox before submitting code for review in Gerrit. It will run pep8 and pyflakes in the same manner as the automated test suite that will run on proposed patchsets.
When creating new YAML components, please observe the following style conventions:
This consistency will help users avoid simple mistakes when writing YAML, as well as developers when matching YAML components to Python implementation.
Unit tests have been included and are in the tests folder. Many unit tests samples are included as examples in our documentation to ensure that examples are kept current with existing behaviour. To run the unit tests, execute the command:
tox -e py34,py27
For YAML support, you will need libyaml installed.
Mac OS X:
$ brew install libyaml
Then install the required python packages using pip:
$ sudo pip install PyYAML python-jenkins
This guide was made with the impatient in mind so explanation is sparse. It will guide users through a set of typical use cases for JJB using the same job definitions we use to test JJB.
Usage of the commands below assumes that you are at the root of the cloned directory.
JJB creates Jenkins XML configuration file from a YAML/JSON definition file and just uploads it to Jenkins. JJB provides a convenient test command to allow you to validate the XML before you attempt to upload it to Jenkins.
Test a YAML job definition:
jenkins-jobs test tests/yamlparser/fixtures/templates002.yaml
The above command prints the generated Jenkins XML to the console. If you prefer to send it to a directory:
jenkins-jobs test -o output tests/yamlparser/fixtures/templates002.yaml
The output directory will contain files with the XML configurations.
Once you've tested your job definition and are happy with it then you can use the update command to deploy the job to Jenkins. The update command requires a configuration file. An example file is supplied in the etc folder, you should update it to match your Jenkins master:
jenkins-jobs --conf etc/jenkins_jobs.ini-sample update tests/yamlparser/fixtures/templates002.yaml
The above command will update your Jenkins master with the generated jobs.
Caution: JJB caches Jenkins job information locally. Changes made using the Jenkins UI will not update that cache, which may lead to confusion. See Updating Jobs for more information.
You can also define your jobs in json instead of yaml:
jenkins-jobs --conf etc/jenkins_jobs.ini-sample update tests/jsonparser/fixtures/simple.json
The above command just uses a simple job definition. You can also convert any of the YAML examples to JSON and feed that to JJB.
To delete a job:
jenkins-jobs --conf etc/jenkins_jobs.ini-sample delete simple
The above command deletes the job simple from the Jenkins master.
To generate a plugins info, using an account with Administrator rights:
jenkins-jobs get-plugins-info -o plugins_info.yaml
To run JJB update using the plugins_info.yaml:
jenkins-jobs update -p plugins_info.yaml ./myjobs
Please refer to the jenkins-jobs Command Reference and the Job Definitions pages for more details.
To install Jenkins Job Builder from source, run:
pip install --user jenkins-job-builder
A virtual environment is recommended for development. For example, Jenkins Job Builder may be installed from the top level directory:
$ virtualenv .venv $ source .venv/bin/activate $ pip install -r test-requirements.txt -e .
Alternatively, the current release can be installed from pypi:
sudo pip install jenkins-job-builder
The OpenStack project uses Puppet to manage its infrastructure systems, including Jenkins. If you use Puppet, you can use the OpenStack Jenkins module to install Jenkins Job Builder.
Documentation is included in the doc folder. To generate docs locally execute the command:
tox -e docs
The generated documentation is then available under doc/build/html/index.html.
As over time URLs change or become stale there is also a testenv available to verify any links added. To run locally execute the command:
tox -e docs-linkcheck
Unit tests have been included and are in the tests folder. We recently started including unit tests as examples in our documentation so to keep the examples up to date it is very important that we include unit tests for every module. To run the unit tests, execute the command:
tox -e py27
To measure test coverage, execute the command:
tox -e cover
After installation, you will need to create a configuration file. By default, jenkins-jobs looks for ~/.config/jenkins_jobs/jenkins_jobs.ini, <script directory>/jenkins_jobs.ini or /etc/jenkins_jobs/jenkins_jobs.ini (in that order), but you may specify an alternative location when running jenkins-jobs. The file should have the following format:
[job_builder] ignore_cache=True keep_descriptions=False include_path=.:scripts:~/git/ recursive=False exclude=.*:manual:./development allow_duplicates=False update=all [jenkins] user=jenkins password=1234567890abcdef1234567890abcdef url=https://jenkins.example.com query_plugins_info=False ##### This is deprecated, use job_builder section instead #ignore_cache=True [plugin "hipchat"] authtoken=dummy [plugin "stash"] username=user password=pass
This section is to control enabling of beta features or behaviour changes that deviate from previously released behaviour in ways that may require effort to convert existing JJB configs to adopt. This essentially will act as a method to share these new behaviours while under active development so they can be changed ahead of releases.
After it's installed and configured, you can invoke Jenkins Job Builder by running jenkins-jobs. You won't be able to do anything useful just yet without a configuration; that is discussed in the next section.
Once you have a configuration defined, you can run the job builder in test mode.
If you want to run a simple test with just a single YAML job definition file and see the XML output on stdout:
jenkins-jobs test /path/to/foo.yaml
You can also pass JJB a directory containing multiple job definition files:
jenkins-jobs test /path/to/defs -o /path/to/output
which will write XML files to the output directory for all of the jobs defined in the defs directory.
If you run:
jenkins-jobs test /path/to/defs -o /path/to/output --config-xml
the output directory will contain config.xml files similar to the internal storage format of Jenkins. This might allow you to more easily compare the output to an existing Jenkins installation.
When you're satisfied with the generated XML from the test, you can run:
jenkins-jobs update /path/to/defs
which will upload the job and view definitions to Jenkins if needed. Jenkins Job Builder maintains, for each host, a cache [1] of previously configured jobs and views, so that you can run that command as often as you like, and it will only update the jobs configurations in Jenkins if the defined definitions have changed since the last time it was run. Note: if you modify a job directly in Jenkins, jenkins-jobs will not know about it and will not update it.
To update a specific list of jobs/views, simply pass the job/view names as additional arguments after the job definition path. To update Foo1 and Foo2 run:
jenkins-jobs update /path/to/defs Foo1 Foo2
You can also enable the parallel execution of the program passing the workers option with a value of 0, 2, or higher. Use 0 to run as many workers as cores in the host that runs it, and 2 or higher to specify the number of workers to use:
jenkins-jobs update --workers 0 /path/to/defs
To update only views or only jobs, simply add the argument --views-only or --jobs-only after the command:
jenkins-jobs update --views-only Foo-view jenkins-jobs update --jobs-only Foo-job
It is possible to pass multiple paths to JJB using colons as a path separator on *nix systems and semi-colons on Windows systems. For example:
jenkins-jobs test /path/to/global:/path/to/instance:/path/to/instance/project
This helps when structuring directory layouts as you may selectively include directories in different ways to suit different needs. If you maintain multiple Jenkins instances suited to various needs you may want to share configuration between those instances (global). Furthermore, there may be various ways you would like to structure jobs within a given instance.
In addition to passing multiple paths to JJB it is also possible to enable recursive searching to process all yaml files in the tree beneath each path. For example:
For a tree:
/path/
to/
defs/
ci_jobs/
release_jobs/
globals/
macros/
templates/
jenkins-jobs update -r /path/to/defs:/path/to/globals
JJB will search defs/ci_jobs, defs/release_jobs, globals/macros and globals/templates in addition to the defs and globals trees.
To allow a complex tree of jobs where some jobs are managed differently without needing to explicitly provide each path, the recursive path processing supports excluding paths based on absolute paths, relative paths and patterns. For example:
For a tree:
/path/
to/
defs/
ci_jobs/
manual/
release_jobs/
manual/
qa_jobs/
globals/
macros/
templates/
special/
jenkins-jobs update -r -x man*:./qa_jobs -x /path/to/defs/globals/special \
/path/to/defs:/path/to/globals
JJB will search the given paths, ignoring the directories qa_jobs, ci_jobs/manual, release_jobs/manual, and globals/special when building the list of yaml files to be processed. Absolute paths are denoted by starting from the root, relative by containing the path separator, and patterns by having neither. Patterns use simple shell globing to match directories.
Jenkins Job Builder supports deleting jobs and views from Jenkins.
To delete a specific job:
jenkins-jobs delete Foo1
To delete a list of jobs or views, simply pass them as additional arguments after the command:
jenkins-jobs delete Foo1 Foo2
To delete only views or only jobs, simply add the argument --views-only or --jobs-only after the command:
jenkins-jobs delete --views-only Foo1 jenkins-jobs delete --jobs-only Foo1
The update command includes a delete-old option to remove obsolete jobs:
jenkins-jobs update --delete-old /path/to/defs
Obsolete jobs are jobs once managed by JJB (as distinguished by a special comment that JJB appends to their description), that were not generated in this JJB run.
There is also a command to delete all jobs and/or views. WARNING: Use with caution.
To delete all jobs and views:
jenkins-jobs delete-all
TO delete all jobs:
jenkins-jobs delete-all --jobs-only
To delete all views:
jenkins-jobs delete-all --views-only
Jenkins job builder supports globbed parameters to identify jobs from a set of definition files. This feature only supports JJB managed jobs.
To update jobs/views that only have 'foo' in their name:
jenkins-jobs update ./myjobs \*foo\*
To delete jobs/views that only have 'foo' in their name:
jenkins-jobs delete --path ./myjobs \*foo\*
With Jenkins LTS 1.651.1+ retrieving plugins info became a secure feature and now requires Administrator rights to use [#f2]. This causes JJB to no longer be able to work in situations where a user wants to publish jobs to Jenkins but is not able to receive the Administrator permissions. In this case we can provide a plugins_info.yaml file containing the plugin versions data needed by JJB to parse the job templates.
To generate a plugins info, using an account with Administrator rights:
To run JJB update using the plugins_info.yaml:
usage: jenkins-jobs [-h] [--conf CONF] [-l LOG_LEVEL] [--ignore-cache]
[--flush-cache] [--version] [--allow-empty-variables]
[--server SECTION] [--user USER] [--password PASSWORD]
{delete,delete-all,get-plugins-info,list,test,update} ...
positional arguments:
{delete,delete-all,get-plugins-info,list,test,update}
update, test, list or delete job
delete-all delete *ALL* jobs from Jenkins server, including those
not managed by Jenkins Job Builder.
get-plugins-info get plugins info yaml by querying Jenkins server.
list List jobs
options:
-h, --help show this help message and exit
--conf CONF configuration file [JJB_CONF]
-l LOG_LEVEL, --log_level LOG_LEVEL
log level (default: info) [JJB_LOG_LEVEL]
--ignore-cache ignore the cache and update the jobs anyhow (that will
only flush the specified jobs cache)
--flush-cache flush all the cache entries before updating
--version show version
--allow-empty-variables
Don't fail if any of the variables inside any string
are not defined, replace with empty string instead.
--server SECTION, -s SECTION
The Jenkins server ini section to use. Defaults to
'jenkins' [JJB_SECTION]
--user USER, -u USER The Jenkins user to use for authentication. This
overrides the user specified in the configuration
file. [JJB_USER]
--password PASSWORD, -p PASSWORD
Password or API token to use for authenticating
towards Jenkins. This overrides the password specified
in the configuration file. [JJB_PASSWORD]
usage: jenkins-jobs test [-h] [-r] [-x EXCLUDE] [--config-xml]
[-p PLUGINS_INFO_PATH] [-o OUTPUT_DIR]
[path] [names ...]
positional arguments:
path colon-separated list of paths to YAML files or
directories
names name(s) of job(s)
options:
-h, --help show this help message and exit
-r, --recursive look for yaml files recursively
-x EXCLUDE, --exclude EXCLUDE
paths to exclude when using recursive search, uses
standard globbing.
--config-xml use alternative output file layout using config.xml
files
-p PLUGINS_INFO_PATH, --plugin-info PLUGINS_INFO_PATH
path to plugin info YAML file
-o OUTPUT_DIR path to output XML
usage: jenkins-jobs update [-h] [-r] [-x EXCLUDE] [--delete-old]
[-p PLUGINS_INFO_PATH] [--workers N_WORKERS]
[--existing-only] [-j | -v]
[path] [names ...]
positional arguments:
path colon-separated list of paths to YAML files or
directories
names name(s) of job(s)
options:
-h, --help show this help message and exit
-r, --recursive look for yaml files recursively
-x EXCLUDE, --exclude EXCLUDE
paths to exclude when using recursive search, uses
standard globbing.
--delete-old delete obsolete jobs
-p PLUGINS_INFO_PATH, --plugin-info PLUGINS_INFO_PATH
path to plugin info YAML file. Can be used to provide
previously retrieved plugins info when connecting
credentials don't have permissions to query.
--workers N_WORKERS number of workers to use, 0 for autodetection and 1
for just one worker.
--existing-only update existing jobs only
-j, --jobs-only update only jobs
-v, --views-only update only views
usage: jenkins-jobs delete-all [-h] [-r] [-x EXCLUDE] [-j] [-v]
options:
-h, --help show this help message and exit
-r, --recursive look for yaml files recursively
-x EXCLUDE, --exclude EXCLUDE
paths to exclude when using recursive search, uses
standard globbing.
-j, --jobs-only delete only jobs
-v, --views-only delete only views
usage: jenkins-jobs delete [-h] [-r] [-x EXCLUDE] [-p PATH] [-j] [-v]
name [name ...]
positional arguments:
name name of job
options:
-h, --help show this help message and exit
-r, --recursive look for yaml files recursively
-x EXCLUDE, --exclude EXCLUDE
paths to exclude when using recursive search, uses
standard globbing.
-p PATH, --path PATH colon-separated list of paths to YAML files or
directories
-j, --jobs-only delete only jobs
-v, --views-only delete only views
usage: jenkins-jobs get-plugins-info [-h] [-o PLUGINS_INFO_FILE]
options:
-h, --help show this help message and exit
-o PLUGINS_INFO_FILE, --output-file PLUGINS_INFO_FILE
file to save output to.
The job definitions for Jenkins Job Builder are kept in any number of YAML or JSON files, in whatever way you would like to organize them. When you invoke jenkins-jobs you may specify either the path of a single YAML file, or a directory. If you choose a directory, all of the .yaml/.yml or .json files in that directory will be read, and all the jobs they define will be created or updated.
NOTE:
Jenkins Job Builder understands a few basic object types which are described in the next sections.
The most straightforward way to create a job is simply to define a Job in YAML. It looks like this:
- job:
name: job-name
That's not very useful, so you'll want to add some actions such as Builders, and perhaps Publishers. Those are described later.
These are job parameters that are common to every type of Jenkins job.
Example:
- job:
name: job-name
project-type: freestyle
defaults: global
description: 'Do not edit this job through the web!'
disabled: false
display-name: 'Fancy job name'
concurrent: true
workspace: /srv/build-area/job-name
quiet-period: 5
block-downstream: false
block-upstream: false
retry-count: 3
node: NodeLabel1 || NodeLabel2
logrotate:
daysToKeep: 3
numToKeep: 20
artifactDaysToKeep: -1
artifactNumToKeep: -1
Requires the Jenkins CloudBees Folders Plugin.
If you need several jobs defined that are nearly identical, except perhaps in their names, SCP targets, etc., then you may use a Job Template to specify the particulars of the job, and then use a Project to realize the job with appropriate variable substitution. Any variables not specified at the project level will be inherited from the Defaults.
A Job Template has the same syntax as a Job, but you may add variables anywhere in the definition. Variables are indicated by enclosing them in braces, e.g., {name} will substitute the variable name. When using a variable in a string field, it is good practice to wrap the entire string in quotes, even if the rules of YAML syntax don't require it because the value of the variable may require quotes after substitution. In the rare situation that you must encode braces within literals inside a template (for example a shell function definition in a builder), doubling the braces will prevent them from being interpreted as a template variable.
You must include a variable in the name field of a Job Template (otherwise, every instance would have the same name). For example:
- job-template:
name: '{name}-unit-tests'
Will not cause any job to be created in Jenkins, however, it will define a template that you can use to create jobs with a Project definition. It's name will depend on what is supplied to the Project.
If you use the variable {template-name}, the name of the template itself (e.g. {name}-unit-tests in the above example) will be substituted in. This is useful in cases where you need to trace a job back to its template.
Sometimes it is useful to have the same job name format used even where the template contents may vary. Ids provide a mechanism to support such use cases in addition to simplifying referencing templates when the name contains the more complex substitution with default values.
To facilitate reuse of templates with many variables that can be substituted, but where in most cases the same or no value is needed, it is possible to specify defaults for the variables within the templates themselves.
There are 2 ways JJB allows us to define defaults for a parameter in a job-template.
With this method we declare the default value of the variable in the job-template itself just once. We can section off the job-template into two sections like this:
- job-template:
name: '{project-name}-verify'
#####################
# Variable Defaults #
#####################
branch: master
#####################
# Job Configuration #
#####################
parameters:
- string:
name: BRANCH
default: '{branch}'
scm:
- git:
refspec: 'refs/heads/{branch}'
In this case there is still two branch definitions for the job-template. However we also provide the default value for the {branch} variable at the top of the file. Just once. This will be the value that the job takes on if it is not passed in by a project using the template.
In this method we can define the default with the definition of the variable. For example:
- job-template:
name: '{project-name}-verify'
parameters:
- string:
name: BRANCH
default: '{branch|master}'
However where this method falls apart if we need to use the same JJB variable in more than one place as we will have multiple places to define the default value for the template. For example:
- job-template:
name: '{project-name}-verify'
parameters:
- string:
name: BRANCH
default: '{branch|master}'
scm:
- git:
refspec: 'refs/heads/{branch|master}'
We can see in this case the {branch|master} variable is defined in two places. Not ideal.
More complex example:
- project:
name: template_variable_defaults
jobs:
- 'template-variable-defaults-{num}':
num: 1
disabled_var: true
- 'template-variable-defaults-{num}':
test_var: Goodbye World
num: 2
- job-template:
# template specific defaults
# empty value causes disabled_var to be ignored internally
disabled_var:
test_var: Hello World
type: periodic
# template settings
name: 'template-variable-defaults-{num}-{type}'
id: 'template-variable-defaults-{num}'
disabled: '{obj:disabled_var}'
builders:
- shell: |
echo "Job Name: template-variable-defaults-{num}-{type}"
echo "Variable: {test_var}"
To use a default value for a variable used in the name would be uncommon unless it was in addition to another variable. However you can use Ids simplify such use cases.
The purpose of a project is to collect related jobs together, and provide values for the variables in a Job Template. It looks like this:
- project:
name: project-name
jobs:
- '{name}-unit-tests'
Any number of arbitrarily named additional fields may be specified, and they will be available for variable substitution in the job template. Any job templates listed under jobs: will be realized with those values. The example above would create the job called 'project-name-unit-tests' in Jenkins.
The jobs: list can also allow for specifying job-specific substitutions as follows:
- project:
name: project-name
jobs:
- '{name}-unit-tests':
mail-to: developer@nowhere.net
- '{name}-perf-tests':
mail-to: projmanager@nowhere.net
If a variable is a list, the job template will be realized with the variable set to each value in the list. Multiple lists will lead to the template being realized with the cartesian product of those values. Example:
- project:
name: project-name
pyver:
- 26
- 27
jobs:
- '{name}-{pyver}'
If there are templates being realized that differ only in the variable used for its name (thus not a use case for job-specific substitutions), additional variables can be specified for project variables. Example:
- job-template:
name: '{name}-{pyver}'
builders:
- shell: 'git co {branch_name}'
- project:
name: project-name
pyver:
- 26:
branch_name: old_branch
- 27:
branch_name: new_branch
jobs:
- '{name}-{pyver}'
You can also specify some variable combinations to exclude from the matrix with the exclude keyword, to avoid generating jobs for those combinations. You can specify all the variables of the combination or only a subset, if you specify a subset, any value of the omited variable will match:
- project:
name: project-name
axe1:
- axe1val1
- axe1val2
axe2:
- axe2val1
- axe2val2
axe3:
- axe3val1
- axe3val2
exclude:
- axe1: axe1val1
axe2: axe2val1
axe3: axe3val2
- axe2: axe2val2
axe3: axe3val1
jobs:
- build-{axe1}-{axe2}-{axe3}
- job-template:
name: build-{axe1}-{axe2}-{axe3}
builders:
- shell: "echo Combination {axe1}:{axe2}:{axe3}"
The above example will omit the jobs:
To achieve the same without the exclude tag one would have to do something a bit more complicated, that gets more complicated for each dimension in the combination, for the previous example, the counterpart would be:
- project:
name: project-name_comb1
axe1:
- axe1val1
- axe1val2
axe2: axe2val1
axe3: axe3val1
jobs:
- build-{axe1}-{axe2}-{axe3}
- project:
name: project-name_comb2
axe1:
- axe1val1
- axe1val2
axe2: axe2val2
axe3: axe3val2
jobs:
- build-{axe1}-{axe2}-{axe3}
- project:
name: project-name_comb3
axe1: axe1val2
axe2: axe2val1
axe3: axe3val2
jobs:
- build-{axe1}-{axe2}-{axe3}
- job-template:
name: build-{axe1}-{axe2}-{axe3}
builders:
- shell: "echo Combination {axe1}:{axe2}:{axe3}"
If you have several Job Templates that should all be realized together, you can define a Job Group to collect them. Simply use the Job Group where you would normally use a Job Template and all of the Job Templates in the Job Group will be realized. For example:
- job-template:
name: '{name}-unit-tests'
builders:
- shell: unittest
publishers:
- email:
recipients: '{mail-to}'
- job-template:
name: '{name}-perf-tests'
builders:
- shell: perftest
publishers:
- email:
recipients: '{mail-to}'
- job-group:
name: '{name}-tests'
jobs:
- '{name}-unit-tests':
mail-to: developer@nowhere.net
- '{name}-perf-tests':
mail-to: projmanager@nowhere.net
- project:
name: project-name
jobs:
- '{name}-tests'
Would cause the jobs project-name-unit-tests and project-name-perf-tests to be created in Jenkins.
A view is a particular way of displaying a specific set of jobs. To create a view, you must define a view in a YAML file and have a variable called view-type with a valid value. It looks like this:
- view:
name: view-name
view-type: list
Views are processed differently than Jobs and therefore will not work within a Project or a Job Template.
Allow views to also be configured via templates similar to job-templates. This is useful when you have multiple views defined that have similar configuration except for a few variables. View Templates can be passed variables to fill in sections automatically via a project configuration using the new 'views' key.
Minimal Example:
- view-template:
name: '{name}-template-{seq}'
description: 'testing view templates feature'
view-type: list
regex: 'test-view-.*'
- project:
name: 'test-view'
views:
- '{name}-template-{seq}'
seq:
- a
- b
- c
Many of the actions of a Job, such as builders or publishers, can be defined as a Macro, and then that Macro used in the Job description. Builders are described later, but let's introduce a simple one now to illustrate the Macro functionality. This snippet will instruct Jenkins to execute "make test" as part of the job:
- job:
name: foo-test
builders:
- shell: 'make test'
If you wanted to define a macro (which won't save much typing in this case, but could still be useful to centralize the definition of a commonly repeated task), the configuration would look like:
- builder:
name: make-test
builders:
- shell: 'make test'
- job:
name: foo-test
builders:
- make-test
This allows you to create complex actions (and even sequences of actions) in YAML that look like first-class Jenkins Job Builder actions. Not every attribute supports Macros, check the documentation for the action before you try to use a Macro for it.
Macros can take parameters, letting you define a generic macro and more specific ones without having to duplicate code:
# The 'add' macro takes a 'number' parameter and will creates a
# job which prints 'Adding ' followed by the 'number' parameter:
- builder:
name: add
builders:
- shell: "echo Adding {number}"
# A specialized macro 'addtwo' reusing the 'add' macro but with
# a 'number' parameter hardcoded to 'two':
- builder:
name: addtwo
builders:
- add:
number: "two"
# Glue to have Jenkins Job Builder to expand this YAML example:
- job:
name: "testingjob"
builders:
# The specialized macro:
- addtwo
# Generic macro call with a parameter
- add:
number: "ZERO"
# Generic macro called without a parameter. Never do this!
# See below for the resulting wrong output :(
- add
Then <builders /> section of the generated job show up as:
<builders>
<hudson.tasks.Shell>
<command>echo Adding two</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>echo Adding ZERO</command>
</hudson.tasks.Shell>
<hudson.tasks.Shell>
<command>echo Adding {number}</command>
</hudson.tasks.Shell>
</builders>
As you can see, the specialized macro addtwo reused the definition from the generic macro add.
If a macro is not passed any parameters it will not have any expansion performed on it. Thus if you forget to provide any parameters to a macro that expects some, the parameter-templates ({foo}) will be left as is in the resulting output; this is almost certainly not what you want. Note if you provide an invalid parameter, the expansion will fail; the expansion will only be skipped if you provide no parameters at all.
Macros are expanded using Python string substitution rules. This can especially cause confusion with shell snippets that use { as part of their syntax. As described, if a macro has no parameters, no expansion will be performed and thus it is correct to write the script with no escaping, e.g.:
- builder:
name: a_builder
builders:
- shell: |
VARIABLE=${VARIABLE:-bar}
function foo {
echo "my shell function"
}
However, if the macro has parameters, you must escape the { you wish to make it through to the output, e.g.:
- builder:
name: a_builder
builders:
- shell: |
PARAMETER={parameter}
VARIABLE=${{VARIABLE:-bar}}
function foo {{
echo "my shell function"
}}
Note that a job-template will have parameters by definition (at least a name). Thus embedded-shell within a job-template should always use {{ to achieve a literal {. A generic builder will need to consider the correct quoting based on its use of parameters.
Jenkins supports organising jobs, views, and slaves using a folder hierarchy. This allows for easier separation of access as well credentials and resources which can be assigned to only be available for a specific folder.
JJB has two methods of supporting uploading jobs to a specific folder:
Supporting both an attributed and use of it directly in job names allows for teams to have all jobs using their defaults automatically use a top-level folder, while still allowing for them to additionally nest jobs for their own preferences.
Job Name Example:
- job:
name: python-jobs/tox-py27
builders:
- shell: |
tox -e py27
Folder Attribute Example:
- defaults:
name: team1
folder: team1-jobs
- job:
name: ruby-jobs/rspec
defaults: team1
builders:
- shell: |
rvm use --create ruby-2.3.0@rspec
bundle install
bundle exec rspec
It's possible to assign an id to any of the blocks and then use that to reference it instead of the name. This has two primary functions:
Example:
- project:
name: test_template_id
jobs:
- 'simple-template':
test_var: Hello World
type: periodic
num: 1
- 'not-as-simple-template':
test_var: Goodbye World
type: canary
num: 2
- job-template:
name: 'template-test-ids-{num}-{type}'
id: simple-template
builders:
- shell: |
echo "Template name: {template-name}"
echo "Job name: template-test-ids-{num}-{type}"
echo "{test_var}"
- job-template:
name: 'template-test-ids-{num}-{type}'
id: not-as-simple-template
builders:
- shell: |
echo "Template name: {template-name}"
echo "Job name: template-test-ids-{num}-{type}"
- shell: |
echo "{test_var}"
It is possible, but not recommended, to use raw within a module to inject raw xml into the job configs.
This is relevant in case there is no appropriate module for a Jenkins plugin or the module does not behave as you expect it to do.
For example:
wrappers:
- raw:
xml: |
<hudson.plugins.xvnc.Xvnc>
<takeScreenshot>true</takeScreenshot>
<useXauthority>false</useXauthority>
</hudson.plugins.xvnc.Xvnc>
Is the raw way of adding support for the xvnc wrapper.
To get the appropriate xml to use you would need to create/edit a job in Jenkins and grab the relevant raw xml segment from the config.xml.
The xml string can refer to variables just like anything else and as such can be parameterized like anything else.
You can use raw in most locations, the following example show them with arbitrary xml-data:
- project:
name: complete002
version:
- 1.2
jobs:
- 'complete001_{version}'
- job-template:
name: 'complete001_{version}'
project-type: maven
scm:
- raw:
xml: |
<!-- <scm> for raw replaces the whole scm section.
where as for others the raw part is added to the existing.
-->
<scm>
<scmraw/>
</scm>
triggers:
- raw:
xml: |
<triggersraw/>
wrappers:
- raw:
xml: |
<wrappersraw/>
builders:
- raw:
xml: |
<buildersraw/>
publishers:
- raw:
xml: |
<publishersraw/>
properties:
- raw:
xml: |
<propertiesraw/>
parameters:
- raw:
xml: |
<parametersraw/>
notifications:
- raw:
xml: |
<metadataraw/>
reporters:
- raw:
xml:
<reportersraw/>
Note: If you have a need to use raw please consider submitting a patch to add or fix the module that will remove your need to use raw.
Defaults collect job attributes (including actions) and will supply those values when the job is created, unless superseded by a value in the 'Job'_ definition. If a set of Defaults is specified with the name global, that will be used by all Job (and Job Template) definitions unless they specify a different Default object with the defaults attribute. For example:
- defaults:
name: global
description: 'Do not edit this job through the web!'
Will set the job description for every job created.
You can define variables that will be realized in a Job Template.
- defaults:
name: global
arch: 'i386'
- project:
name: project-name
jobs:
- 'build-{arch}'
- 'build-{arch}':
arch: 'amd64'
- job-template:
name: 'build-{arch}'
builders:
- shell: "echo Build arch {arch}."
Would create jobs build-i386 and build-amd64.
You can also reference a variable {template-name} in any value and it will be subtitued by the name of the current job template being processed.
If you want to pass an object (boolean, list or dict) to templates you can use an {obj:key} variable in the job template. This triggers the use of code that retains the original object type.
For example:
- project:
name: test_custom_distri
disabled: true
distributions: !!python/tuple [precise, jessie]
architectures: !!python/tuple &architectures
- amd64
- i386
axis_a:
type: user-defined
name: architectures
values: *architectures
jobs:
- '{name}-source'
- job-template:
name: '{name}-source'
project-type: matrix
disabled: '{obj:disabled}'
axes:
- axis:
type: user-defined
name: distribution
values: '{obj:distributions}'
- axis: '{obj:axis_a}'
JJB also supports interpolation of parameters within parameters. This allows a little more flexibility when ordering template jobs as components in different projects and job groups.
For example:
- job-template:
name: '{value-stream}_{project-id}_foo'
display-name: '{value-stream} {project-id} foo'
publishers:
- trigger-parameterized-builds:
- project: '{downstream}'
current-parameters: False
condition: ALWAYS
git-revision: True
- job-template:
name: '{value-stream}_{project-id}_bar'
display-name: '{value-stream} {project-id} bar'
publishers:
- trigger-parameterized-builds:
- project: '{downstream}'
current-parameters: False
condition: ALWAYS
git-revision: True
- job-group:
name: 'pipeline2'
project-id: 'p2'
jobs:
- '{value-stream}_{project-id}_foo':
downstream: '{value-stream}_{project-id}_bar'
- '{value-stream}_{project-id}_bar':
- job-group:
name: 'pipeline1'
project-id: 'p1'
jobs:
- '{value-stream}_{project-id}_bar':
downstream: '{value-stream}_{project-id}_foo'
- '{value-stream}_{project-id}_foo':
- project:
name: derp
jobs:
- 'pipeline1':
value-stream: 'production'
- 'pipeline2':
value-stream: 'experimental'
- defaults:
name: 'global'
downstream: ''
By default JJB will fail if it tries to interpolate a variable that was not defined, but you can change that behavior and allow empty variables with the allow_empty_variables configuration option.
For example, having a configuration file with that option enabled:
[job_builder] allow_empty_variables = True
Will prevent JJb from failing if there are any non-initialized variables used and replace them with the empty string instead.
TIP:
It is possible in JJB to define defaults for variables at different levels such that it is possible for users of job-templates to override variables defined in the job-template.
Variable priorities for each definition type are as follows:
From this list we can immediately see that if we want to make variables in job-templates override-able then using defaults configuration is useless as it has the lowest precedence when JJB is deciding where to pull from.
On the other side of the spectrum, job-groups has the highest precedence. Which unfortunately means if we define a variable in a job-group with the intention of overriding it at the project level then we are out of luck. For this reason avoid setting variables in job-groups unless we want to enforce a setting for a set of jobs and prevent projects from overriding it.
Refer to Default Values for Template Variables for details on how to declare variable defaults.
When a project wants to use a job-template it can use override it as follows:
- project:
name: foo
jobs:
- '{project-name}-merge'
- '{project-name}-verify'
branch: master
This is the standard way that most folks use and it will set branch: master for every job-template in the list. However sometimes we may want to provide an alternative value for a specific job in the list. In this case the more specific declaration takes precedence:
- project:
name: foo
jobs:
- '{project-name}-merge':
branch: production
- '{project-name}-verify'
branch: master
In this case the verify job will get the value master but the merge job will instead get the branch value production.
The yaml specification supports anchors and aliases which means that JJB definitions allow references to variables in templates.
For example:
- wrapper_defaults: &wrapper_defaults
name: 'wrapper_defaults'
wrappers:
- timeout:
timeout: 180
fail: true
- timestamps
- job_defaults: &job_defaults
name: 'defaults'
<<: *wrapper_defaults
- job-template:
name: 'myjob'
<<: *job_defaults
- project:
name: myproject
jobs:
- myjob
The anchors and aliases are expanded internally within JJB's yaml loading calls and are not limited to individual documents. That means you can't use the same anchor name in included files without collisions.
A simple example can be seen in the specs full length example with the following being more representative of usage within JJB:
- wrapper_defaults: &wrapper_defaults
name: 'wrapper_defaults'
wrappers:
- timeout:
timeout: 180
fail: true
- timestamps
- job_defaults: &job_defaults
name: 'defaults'
<<: *wrapper_defaults
- job-template:
name: 'myjob'
<<: *job_defaults
Which will be expanded to the following yaml before being processed:
- wrapper_defaults:
name: wrapper_defaults
wrappers:
- timeout:
fail: true
timeout: 180
- timestamps
- job_defaults:
name: defaults
wrappers:
- timeout:
fail: true
timeout: 180
- timestamps
- job-template:
name: myjob
wrappers:
- timeout:
fail: true
timeout: 180
- timestamps
Custom application specific yamls tags are supported to provide enhancements when reading yaml configuration.
These allow manipulation of data being stored in one layout in the source yaml for convenience and/or clarity, to another format to be processed by the targeted module instead of requiring all modules in JJB being capable of supporting multiple input formats.
The tag !join: will treat the first element of the following list as the delimiter to use, when joining the remaining elements into a string and returning a single string to be consumed by the specified module option.
This allows users to maintain elements of data in a list structure for ease of review/maintenance, and have the yaml parser convert it to a string for consumption as any argument for modules. The main expected use case is to allow for generic plugin data such as shell properties to be populated from a list construct which the yaml parser converts to a single string, instead of trying to support this within the module code which would require a templating engine similar to Jinja.
Generic Example:
- string-with-comma: !join:
- ','
-
- item1
- item2
- item3
- string-with-space: !join:
- ' '
-
- item1
- item2
- item3
Environment Inject:
- project:
name: string_join_example
jobs:
- 'string-join-data-{name}':
name: set1
files: !join:
- ','
-
- /path/to/file1
- /path/to/file2
- /path/to/file3
- /path/to/file4
- /path/to/file5
- /path/to/file6
- /path/to/file7
- /path/to/file8
- /path/to/file9
- /path/to/file10
- /path/to/file11
- /path/to/file12
- /path/to/file13
- /path/to/file14
- /path/to/file15
- /path/to/file16
- /path/to/file17
- /path/to/file18
- /path/to/file19
- /path/to/file20
- 'string-join-data-{name}':
name: set2
files: !join:
- ','
-
- /another/different/path/to/file1
- /another/different/path/to/file2
- /another/different/path/to/file3
- /another/different/path/to/file4
- /another/different/path/to/file5
- /another/different/path/to/file6
- /another/different/path/to/file7
- /another/different/path/to/file8
- /another/different/path/to/file9
- /another/different/path/to/file10
- /another/different/path/to/file11
- /another/different/path/to/file12
- /another/different/path/to/file13
- /another/different/path/to/file14
- /another/different/path/to/file15
- /another/different/path/to/file16
- /another/different/path/to/file17
- /another/different/path/to/file18
- /another/different/path/to/file19
- /another/different/path/to/file20
- job-template:
name: 'string-join-data-{name}'
properties:
- inject:
keep-system-variables: true
properties-content: |
FILE_LIST={files}
builders:
- shell: |
echo "Template name: {template-name}"
echo "Data to be processed:"
echo "${{INPUT_DATA}}"
While this mechanism can also be used items where delimiters are supported by the module, that should be considered a bug that the existing code doesn't handle being provided a list and delimiter to perform the correct conversion for you. Should you discover a module that takes arguments with delimiters and the existing JJB codebase does not handle accepting lists, then this can be used as a temporary solution in place of using very long strings:
Extended Params Example:
parameters:
- extended-choice:
name: OPTIONS_VALUE
description: "Available options"
property-key: key
quote-value: true
type: multi-select
value: "foo|bar|select"
visible-items: 2
multi-select-delimiter: '|'
default-value: foo
default-property-key: fookey
- extended-choice:
name: OPTIONS_FILE
description: "Available options"
property-file: /home/foo/property.prop
property-key: key
quote-value: true
type: multi-select
visible-items: 2
multi-select-delimiter: '|'
default-property-file: /home/property.prop
default-property-key: fookey
- extended-choice:
name: OPTIONS_CHECKBOX
type: checkbox
value: !join:
- ','
-
- OptionA
- OptionB
- OptionC
visible-items: 2
- extended-choice:
name: MULTISELECTOPTIONS
description: "Available options"
property-key: key
quote-value: true
type: multi-select
value: !join:
- '|'
-
- foo
- bar
- select
visible-items: 2
multi-select-delimiter: '|'
default-value: foo
- extended-choice:
name: JSON
type: json
groovy-script: >-
import net.sf.json.JSONObject;
def jsonEditorOptions = JSONObject.fromObject(/{schema:
{"type": "object", "title": "Name", "properties":
{"name": {"type": "string", "propertyOrder" : 1}}}}/);
- extended-choice:
name: MULTILEVELMULTISELECT
type: multi-level-multi-select
value: !join:
- ','
-
- foo
- bar
- baz
- extended-choice:
name: MULTILEVELSINGLESELECT
type: multi-level-single-select
value: foo
These allow inclusion of arbitrary files as a method of having blocks of data managed separately to the yaml job configurations. A specific usage of this is inlining scripts contained in separate files, although such tags may also be used to simplify usage of macros or job templates.
The tag !include: will treat the following string as file which should be parsed as yaml configuration data.
Example:
- job:
name: test-job-1
builders:
!include: include001.yaml.inc
contents of include001.yaml.inc:
- timeout-wrapper - pre-scm-shell-ant - copy-files
The tag !include-raw: will treat the given string or list of strings as filenames to be opened as one or more data blob, which should be read into the calling yaml construct without any further parsing. Any data in a file included through this tag, will be treated as string data.
Examples:
- job:
name: test-job-include-raw-1
builders:
- shell:
!include-raw: include-raw001-hello-world.sh
- shell:
!include-raw: include-raw001-vars.sh
contents of include-raw001-hello-world.sh:
#!/bin/bash # # Sample script showing how the yaml include-raw tag can be used # to inline scripts that are maintained outside of the jenkins # job yaml configuration. echo "hello world" exit 0
contents of include-raw001-vars.sh:
#!/bin/bash
#
# sample script to check that brackets aren't escaped
# when using the include-raw application yaml tag
VAR1="hello"
VAR2="world"
VAR3="${VAR1} ${VAR2}"
[[ -n "${VAR3}" ]] && {
# this next section is executed as one
echo "${VAR3}"
exit 0
}
using a list of files:
- job:
name: test-job-include-raw-1
builders:
- shell:
!include-raw:
- include-raw001-hello-world.sh
- include-raw001-vars.sh
The tag !include-raw-escape: treats the given string or list of strings as filenames to be opened as one or more data blobs, which should be escaped before being read in as string data. This allows job-templates to use this tag to include scripts from files without needing to escape braces in the original file.
WARNING:
Examples:
- job-template:
name: test-job-include-raw-{num}
builders:
- shell:
!include-raw-escape: include-raw001-hello-world.sh
- shell:
!include-raw-escape: include-raw001-vars.sh
- project:
name: test-job-template-1
num: 1
jobs:
- 'test-job-include-raw-{num}'
contents of include-raw001-hello-world.sh:
#!/bin/bash # # Sample script showing how the yaml include-raw tag can be used # to inline scripts that are maintained outside of the jenkins # job yaml configuration. echo "hello world" exit 0
contents of include-raw001-vars.sh:
#!/bin/bash
#
# sample script to check that brackets aren't escaped
# when using the include-raw application yaml tag
VAR1="hello"
VAR2="world"
VAR3="${VAR1} ${VAR2}"
[[ -n "${VAR3}" ]] && {
# this next section is executed as one
echo "${VAR3}"
exit 0
}
using a list of files:
- job-template:
name: test-job-include-raw-{num}
builders:
- shell:
!include-raw-escape:
- include-raw001-hello-world.sh
- include-raw001-vars.sh
- project:
name: test-job-template-1
num: 1
jobs:
- 'test-job-include-raw-{num}'
For all the multi file includes, the files are simply appended using a newline character.
To allow for job templates to perform substitution on the path names, when a filename containing a python format placeholder is encountered, lazy loading support is enabled, where instead of returning the contents back during yaml parsing, it is delayed until the variable substitution is performed.
Example:
- wrapper:
!include: lazy-load-jobs-timeout.yaml.inc
- project:
name: test
version:
- 1.1
jobs:
- 'build_myproject_{version}'
- job-template:
name: 'build_myproject_{version}'
wrappers:
!include: lazy-load-wrappers-{version}.yaml.inc
builders:
- shell:
!include-raw: echo_vars_{version}.sh
using a list of files:
- wrapper:
!include: lazy-load-jobs-timeout.yaml.inc
- project:
name: test
num: "002"
version:
- 1.1
jobs:
- 'build_myproject_{version}'
- job-template:
name: 'build_myproject_{version}'
wrappers:
!include: lazy-load-wrappers-{version}.yaml.inc
builders:
- shell:
!include-raw:
- lazy-load-scripts/echo_vars_{version}.sh
- include-raw{num}-cool.sh
NOTE:
Given the behaviour described above, when substitution is to be performed on any filename passed via !include-raw-escape: the tag will be automatically converted to !include-raw: and no escaping will be performed.
The tag !include-jinja2: will treat the given string or list of strings as filenames to be opened as Jinja2 templates, which should be rendered to a string and included in the calling YAML construct. (This is analogous to the templating that will happen with !include-raw.)
Examples:
- builder:
name: test-builder
builders:
- shell:
!include-jinja2: jinja01.yaml.inc
- job:
name: test-job
builders:
- test-builder:
var: "test variable"
test_list:
- a
- b
- c
contents of jinja01.yaml.inc:
{{ var }}
{% for item in test_list -%}
{{ item }}
{% endfor %}
The tag !j2: takes a string and treats it as a Jinja2 template. It will be rendered (with the variables in that context) and included in the calling YAML construct.
Examples:
- builder:
name: test-builder
builders:
- shell:
!j2: |
{{ var }}
{% for item in test_list -%}
{{ item }}
{% endfor %}
- job:
name: test-job
builders:
- test-builder:
var: "test variable"
test_list:
- a
- b
- c
The tag !j2-yaml: is similar to the !j2: tag, just that it loads the Jinja-rendered string as YAML and embeds it in the calling YAML construct. This provides a very flexible and convenient way of generating pieces of YAML structures. One of use cases is defining complex YAML structures with much simpler configuration, without any duplication.
Examples:
- job-template:
name: test-job-template
triggers:
- gerrit:
projects:
!j2-yaml: |
{% for item in triggers %}
- branches:
- branch-compare-type: PLAIN
branch-pattern: '{{ item.branch }}'
project-compare-type: REG_EXP
project-pattern: '{{ item.repositories|join("|") }}'
{% endfor %}
- project:
name: test-job-project
jobs:
- test-job-template:
triggers:
- repositories:
- a
- b
- c
branch: master
- repositories:
- d
- e
- f
branch: stable
Another use case is controlling lists dynamically, like conditionally adding list elements based on project configuration.
Examples:
- job-template:
name: 'test-job-{variant}'
properties: !j2-yaml: |
- rebuild
{% if discard_old_builds|default %}
- build-discarder:
days-to-keep: 7
{% endif %}
- project:
name: test-project
jobs:
- 'test-job-{variant}':
variant: abc
- 'test-job-{variant}':
variant: def
discard_old_builds: true
The bulk of the job definitions come from the following modules.
The External Job Project module handles creating ExternalJob Jenkins projects. You may specify externaljob in the project-type attribute of the Job definition.
This type of job allows you to record the execution of a process run outside Jenkins, even on a remote machine. This is designed so that you can use Jenkins as a dashboard of your existing automation system.
Requires the Jenkins External Monitor Job Type Plugin.
Example:
name: openstack-infra project-type: externaljob
The flow Project module handles creating Jenkins flow projects. You may specify flow in the project-type attribute of the Job definition.
Requires the Jenkins Build Flow Plugin.
In order to use it for job-template you have to escape the curly braces by doubling them in the DSL: { -> {{ , otherwise it will be interpreted by the python str.format() command.
Job example:
- job:
name: test_job
project-type: flow
dsl: |
build("job1")
parallel (
{ build("job2a") },
{ build("job2b") }
)
Job template example:
- job-template:
name: '{name}-unit-tests'
project-type: flow
dsl: |
build("job1")
parallel (
{{ build("job2a") }},
{{ build("job2b") }}
)
build("job2c")
builders:
- shell: unittest
publishers:
- email:
recipients: '{mail-to}'
- job-group:
name: '{name}-tests'
jobs:
- '{name}-unit-tests':
mail-to: developer@nowhere.net
- project:
name: project-name
jobs:
- '{name}-tests'
Job example runninng a DSL file from the workspace:
- job:
name: test_job
project-type: flow
needs-workspace: true
dsl-file: script.groovy
The folder Project module handles creating Jenkins folder projects. You may specify folder in the project-type attribute of the Job definition.
Requires the Jenkins CloudBees Folders Plugin.
Job example:
- job:
name: folder_test
project-type: folder
Job template example:
- job-template:
name: 'folder-{name}'
project-type: folder
- project:
name: test
jobs:
- 'folder-{name}'
The Freestyle Project module handles creating freestyle Jenkins projects (i.e., those that do not use Maven). You may specify freestyle in the project-type attribute to the Job definition if you wish, though it is the default, so you may omit project-type altogether if you are creating a freestyle project.
Example:
job: name: test_job project-type: freestyle
The Github Organization project module handles creating Jenkins Github Organization jobs, which are made up of multibranch pipelines for all repositories containing the specified Jenkinsfile(s). You may specify githuborg in the project-type attribute of the Job definition.
Plugins required:
Job examples:
name: github-org-minimal
project-type: githuborg
project: example-project
github-org:
repo-owner: example-owner
name: githuborg-job-full
project-type: githuborg
project: example-project
periodic-folder-trigger: 2h
prune-dead-branches: false
number-to-keep: 10
days-to-keep: 90
script-path: some.Jenkinsfile
github-org:
repo-owner: example-owner
Checkout over SSH.
Job examples:
name: github-org-minimal
project-type: githuborg
project: example-project
github-org:
repo-owner: example-owner
name: github-org-full
project-type: githuborg
github-org:
api-uri: http://example.org/github
ssh-checkout:
credentials: 'ssh_secret'
repo-owner: example-owner
credentials-id: example-credential
branch-discovery: all
head-filter-regex: "(.*/master|.*/release/.*)"
head-pr-filter-behaviors:
head-pr-destined-regex:
branch-regexp: "foo/.*"
tag-regexp: "20\\..*"
head-pr-destined-wildcard:
branch-includes: "foo*"
tag-includes: "qaz*"
branch-excludes: "bar*"
tag-excludes: "*baz"
head-pr-originated-regex:
branch-regexp: "(foo/.*|bar/.*)"
tag-regexp: "1\\..*"
head-pr-originated-wildcard:
branch-includes: "qaz*"
tag-includes: "bar*"
branch-excludes: "baz*"
tag-excludes: "*qaz"
discover-pr-forks-strategy: both
discover-pr-forks-trust: everyone
discover-pr-origin: both
discover-tags: true
notification-context: 'jenkins.example.com/my_context'
property-strategies:
all-branches:
- suppress-scm-triggering: true
- pipeline-branch-durability-override: max-survivability
- trigger-build-on-pr-comment: "Ci build!"
- trigger-build-on-pr-review: true
- trigger-build-on-pr-update: true
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
clean:
after: true
before: true
committer:
user: CI System
email: no-reply@ci.example.com
prune: true
local-branch: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
disable-pr-notifications: true
refspecs:
- '+refs/heads/*:refs/remotes/@{remote}/*'
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true
The matrix project module handles creating Jenkins matrix projects. To create a matrix project specify matrix in the project-type attribute to the Job definition. Currently it supports four axes which share the same internal YAML structure:
Requires the Jenkins Matrix Project Plugin.
The module also supports additional, plugin-defined axes:
To tie the parent job to a specific node, you should use node parameter. On a matrix project, this will tie only the parent job. To restrict axes jobs, you can define a single value slave axis.
The module supports also ShiningPanda axes:
Example:
name: matrix-test003
project-type: matrix
axes:
- axis:
type: python
values:
- python-2.6
- python-2.7
- python-3.4
- axis:
type: tox
values:
- py26
- py27
- py34
Requires the Jenkins ShiningPanda Plugin.
Example:
- job:
name: matrix-test
project-type: matrix
execution-strategy:
combination-filter: |
!(os=="fedora11" && arch=="amd64")
sequential: true
touchstone:
expr: 'os == "fedora11"'
result: unstable
axes:
- axis:
type: label-expression
name: os
values:
- ubuntu12.04
- fedora11
- axis:
type: label-expression
name: arch
values:
- amd64
- i386
- axis:
type: slave
name: nodes
values:
- node1
- node2
- axis:
type: dynamic
name: config
values:
- config_list
- axis:
type: user-defined
name: database
values:
- mysql
- postgresql
- sqlite
- axis:
type: groovy
name: foo
command: return [one,two,three]
builders:
- shell: make && make check
Examples for yaml axis:
name: matrix-with-yaml-axis
project-type: matrix
axes:
- axis:
type: yaml
filename: config.yaml
name: python
- axis:
type: yaml
filename: config.yaml
name: database
name: matrix-with-yaml-strategy-and-exclude-in-file
project-type: matrix
yaml-strategy:
exclude-key: 'exclude'
filename: 'exclude.yaml'
axes:
- axis:
type: yaml
filename: 'config.yaml'
name: python
- axis:
type: yaml
filename: 'config.yaml'
name: database
name: matrix-with-yaml-strategy-and-inlined-exclude
project-type: matrix
yaml-strategy:
exclude-key: 'exclude'
text: |
exclude:
- database: postgre
python: py27
- python: py35
database: mysql
axes:
- axis:
type: yaml
filename: config.yaml
name: python
- axis:
type: yaml
filename: config.yaml
name: database
The Maven Project module handles creating Maven Jenkins projects.
To create a Maven project, specify maven in the project-type attribute to the Job definition. It also requires a maven section in the Job definition.
Requires the Jenkins Config File Provider Plugin for the Config File Provider "settings" and "global-settings" config.
Example:
project-type: maven
maven:
root-pom: pom.xml
goals: deploy
root-module:
group-id: gabba.gabba
artifact-id: hey
settings: test
global-settings: test
incremental-build: true
automatic-archiving: false
automatic-site-archiving: false
parallel-build-modules: true
resolve-dependencies: true
process-plugins: true
run-headless: true
disable-downstream: true
custom-workspace: path/to/some/repository
CFP Example:
project-type: maven maven: root-pom: pom.xml goals: deploy settings: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012 global-settings: org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig0123456789012 post-step-run-condition: SUCCESS
The MultiJob Project module handles creating MultiJob Jenkins projects. You may specify multijob in the project-type attribute of the Job definition.
This project type may use jenkins_jobs.modules.builders.multijob() builders.
Requires the Jenkins Multijob Plugin.
Example:
job:
name: test_job
project-type: multijob
builders:
- multijob:
name: PhaseOne
condition: SUCCESSFUL
projects:
- name: PhaseOneJobA
current-parameters: true
git-revision: true
- name: PhaseOneJobB
current-parameters: true
property-file: build.props
- multijob:
name: PhaseTwo
condition: UNSTABLE
projects:
- name: PhaseTwoJobA
current-parameters: true
predefined-parameters: foo=bar
- name: PhaseTwoJobB
current-parameters: false
The Pipeline Project module handles creating Jenkins Pipeline projects (formerly known as the Workflow projects). You may specify pipeline in the project-type attribute of the Job definition.
Requires the Jenkins Pipeline Plugin.
In order to write an inline script within a job-template you have to escape the curly braces by doubling them in the DSL: { -> {{ , otherwise it will be interpreted by the python str.format() command.
Note that dsl and pipeline-scm parameters are mutually exclusive.
Inline DSL job example:
- job:
name: test_job
project-type: pipeline
dsl: |
build job: "job1"
parallel [
2a: build job: "job2a",
2b: node "dummynode" {
sh "echo I'm alive!"
}
]
Inline DSL job template example:
- job-template:
name: '{name}-unit-tests'
project-type: pipeline
dsl: |
build job: "job1"
parallel [
2a: build job: "job2a",
2b: node "dummynode" {{
sh "echo {isay}"
}}
]
- job-group:
name: '{name}-tests'
jobs:
- '{name}-unit-tests':
isay: 'hello'
- project:
name: project-name
jobs:
- '{name}-tests'
"Pipeline as code" example:
- job:
name: test-job
project-type: pipeline
sandbox: true
pipeline-scm:
scm:
- hg:
url: http://hg.example.org/test_job
clean: true
script-path: Jenkinsfile.groovy
lightweight-checkout: true
"Pipeline as code" example using templates:
- scm:
name: project-scm
scm:
- hg:
url: http://hg.example.org/project
clean: true
- job-template:
name: '{name}-unit-tests'
project-type: pipeline
pipeline-scm:
scm:
- project-scm
sandbox: true
description: 'maintainer: {maintainer}'
- job-template:
name: '{name}-perf-tests'
project-type: pipeline
pipeline-scm:
scm:
- project-scm
sandbox: false
description: 'maintainer: {maintainer}'
- job-group:
name: '{name}-tests'
jobs:
- '{name}-unit-tests':
maintainer: dev@example.org
- '{name}-perf-tests':
maintainer: qa@example.org
- project:
name: project-name
jobs:
- '{name}-tests'
"Pipeline as nested stage" example :
- job-template:
name: '{name}-unit-tests'
project-type: pipeline
dsl: |
stage('Build another job') {{
build(job: "{isay}")
}}
- job-group:
name: '{name}-tests'
jobs:
- '{name}-unit-tests':
isay: 'hello'
- project:
name: project-name
jobs:
- '{name}-tests'
Deprecated: please use Pipeline Project instead.
The workflow Project module handles creating Jenkins workflow projects. You may specify workflow in the project-type attribute of the Job definition. For now only inline scripts are supported.
Requires the Jenkins Workflow Plugin.
In order to use it for job-template you have to escape the curly braces by doubling them in the DSL: { -> {{ , otherwise it will be interpreted by the python str.format() command.
Job example:
- job:
name: test_job
project-type: workflow
dsl: |
build job: "job1"
parallel [
2a: build job: "job2a",
2b: node "dummynode" {
sh "echo I'm alive!"
}
]
Job template example:
- job-template:
name: '{name}-unit-tests'
project-type: workflow
dsl: |
build job: "job1"
parallel [
2a: build job: "job2a",
2b: node "dummynode" {{
sh "echo {isay}"
}}
]
- job-group:
name: '{name}-tests'
jobs:
- '{name}-unit-tests':
isay: 'hello'
- project:
name: project-name
jobs:
- '{name}-tests'
The Multibranch Pipeline project module handles creating Jenkins workflow projects. You may specify multibranch in the project-type attribute of the Job definition.
Multibranch Pipeline implementantion in JJB is marked as experimental which means that there is no guarantee that its behavior (or configuration) will not change, even between minor releases.
Plugins required:
Job examples:
name: 'demo-multibranch-defaults'
project-type: multibranch-defaults
script-id: my-pipeline
sandbox: true
scm:
- github:
repo: 'foo'
repo-owner: 'johndoe'
credentials-id: 'secret'
name: 'demo-multibranch-defaults'
project-type: multibranch-defaults
scm:
- github:
repo: 'foo'
repo-owner: 'johndoe'
credentials-id: 'secret'
name: 'demo-multibranch-multi-scm-full'
description: 'Workflow demo'
project-type: multibranch
periodic-folder-trigger: 1d
prune-dead-branches: True
number-to-keep: '10'
days-to-keep: '10'
script-path: 'some.Jenkinsfile'
scm:
- bitbucket:
repo-owner: 'SANDBOX'
repo: 'test'
credentials-id: 'secret'
- git:
url: 'https://example.com/jonhndoe/keep-frontend.git'
credentials-id: 'secret'
- github:
repo: 'foo'
repo-owner: 'johndoe'
credentials-id: 'secret'
Requires the SCM Filter Branch PR Plugin.
Definition of filters.
Enable filter by name with wildcards. Requires the SCM API Plugin.
Requires the Bitbucket Branch Source Plugin.
Checkout repo over ssh.
Enable filter by name with wildcards. Requires the SCM API Plugin.
Minimal Example:
name: 'demo-multibranch-bitbucket-min'
project-type: multibranch
scm:
- bitbucket:
repo-owner: 'SANDBOX'
repo: 'test'
Full Example:
name: 'demo-multibranch-bitbucket-min'
project-type: multibranch
script-path: 'some.Jenkinsfile'
scm:
- bitbucket:
credentials-id: 'secret'
repo-owner: 'SANDBOX'
repo: 'test'
server-url: https://bitbucket.example.com:8080
discover-tags: true
lfs: true
head-filter-regex: 'master|\d+\.\d+'
head-pr-filter-behaviors:
head-pr-destined-regex:
branch-regexp: "foo/.*"
tag-regexp: "20\\..*"
head-pr-destined-wildcard:
branch-includes: "foo*"
tag-includes: "qaz*"
branch-excludes: "bar*"
tag-excludes: "*baz"
head-pr-originated-regex:
branch-regexp: "(foo/.*|bar/.*)"
tag-regexp: "1\\..*"
head-pr-originated-wildcard:
branch-includes: "qaz*"
tag-includes: "bar*"
branch-excludes: "baz*"
tag-excludes: "*qaz"
discover-pr-origin: headOnly
discover-branch: all
discover-pr-forks-strategy: current
discover-pr-forks-trust: everyone
local-branch: true
checkout-over-ssh:
credentials: 'ssh_secret'
filter-by-name-wildcard:
includes: '*'
excludes: 'master'
property-strategies:
all-branches:
- suppress-scm-triggering: true
- pipeline-branch-durability-override: max-survivability
refspecs:
- '+refs/heads/*:refs/remotes/@{remote}/*'
- '+refs/tags/*:refs/remotes/@{remote}/*'
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
clean:
after: true
before: true
committer:
user: CI System
email: no-reply@ci.example.com
prune: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true
Requires the Basic Branch Build Strategies Plugin.
Other build strategies can be configured via raw XML injection.
Definition of build strategies.
Requires the Gerrit Code Review Plugin.
Minimal Example:
name: 'demo-multibranch-gerrit-min'
project-type: multibranch
scm:
- gerrit:
url: 'https://review.gerrithub.io/johndoe/foo'
Full Example:
name: 'demo-multibranch-gerrit-min'
project-type: multibranch
script-path: some.Jenkinsfile
scm:
- gerrit:
url: 'https://review.gerrithub.io/johndoe/foo'
credentials-id: secret
ignore-on-push-notifications: true
refspecs: 'refs/heads/*'
property-strategies:
all-branches:
- suppress-scm-triggering: true
- pipeline-branch-durability-override: max-survivability
filter-checks:
query-operator: 'SCHEME'
query-string: 'jenkins'
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
clean:
after: true
before: true
prune: true
local-branch: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
use-author: true
wipe-workspace: true
lfs-pull: true
Requires the Git Plugin.
Minimal Example:
name: 'demo-multibranch-git-min'
project-type: multibranch
scm:
- git:
url: 'https://example.com/jonhndoe/keep-frontend.git'
Full Example:
name: 'demo-multibranch-git-min'
project-type: multibranch
script-path: some.Jenkinsfile
scm:
- git:
url: 'https://example.com/jonhndoe/keep-frontend.git'
credentials-id: secret
discover-branches: false
ignore-on-push-notifications: true
discover-tags: true
head-filter-regex: 'master|\d+\.\d+'
head-pr-filter-behaviors:
head-pr-destined-regex:
branch-regexp: "foo/.*"
tag-regexp: "20\\..*"
head-pr-destined-wildcard:
branch-includes: "foo*"
tag-includes: "qaz*"
branch-excludes: "bar*"
tag-excludes: "*baz"
head-pr-originated-regex:
branch-regexp: "(foo/.*|bar/.*)"
tag-regexp: "1\\..*"
head-pr-originated-wildcard:
branch-includes: "qaz*"
tag-includes: "bar*"
branch-excludes: "baz*"
tag-excludes: "*qaz"
property-strategies:
all-branches:
- suppress-scm-triggering: true
- pipeline-branch-durability-override: max-survivability
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
- raw:
xml: |
<com.igalg.jenkins.plugins.multibranch.buildstrategy.IncludeRegionBranchBuildStrategy plugin="multibranch-build-strategy-extension">
<includedRegions>my/cool/project/*.cpp</includedRegions>
</com.igalg.jenkins.plugins.multibranch.buildstrategy.IncludeRegionBranchBuildStrategy>
clean:
after: true
before: true
prune: true
local-branch: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
use-author: true
wipe-workspace: true
lfs-pull: true
Requires the GitHub Branch Source Plugin.
Checkout over SSH.
Enable filter by name with wildcards. Requires the SCM API Plugin.
Minimal Example:
name: 'demo-multibranch-github-min'
project-type: multibranch
scm:
- github:
repo: 'foo'
repo-owner: 'johndoe'
Full Example:
name: scm-github-full
project-type: multibranch
script-path: some.Jenkinsfile
scm:
- github:
api-uri: http://example.org/github
ssh-checkout:
credentials: 'ssh_secret'
repo: example-repo
repo-owner: example-owner
credentials-id: example-credential
branch-discovery: all
head-filter-regex: "(.*/master|.*/release/.*)"
head-pr-filter-behaviors:
head-pr-destined-regex:
branch-regexp: "foo/.*"
tag-regexp: "20\\..*"
head-pr-destined-wildcard:
branch-includes: "foo*"
tag-includes: "qaz*"
branch-excludes: "bar*"
tag-excludes: "*baz"
head-pr-originated-regex:
branch-regexp: "(foo/.*|bar/.*)"
tag-regexp: "1\\..*"
head-pr-originated-wildcard:
branch-includes: "qaz*"
tag-includes: "bar*"
branch-excludes: "baz*"
tag-excludes: "*qaz"
discover-pr-forks-strategy: both
discover-pr-forks-trust: everyone
discover-pr-origin: both
discover-tags: true
notification-context: 'jenkins.example.com/my_context'
property-strategies:
all-branches:
- suppress-scm-triggering: true
- pipeline-branch-durability-override: max-survivability
- trigger-build-on-pr-comment: "Ci build!"
- trigger-build-on-pr-review: true
- trigger-build-on-pr-update: true
build-strategies:
- all-strategies-match:
strategies:
- regular-branches: true
- skip-initial-build: true
- any-strategies-match:
strategies:
- change-request: {}
- tags: {}
- tags:
ignore-tags-newer-than: 1
ignore-tags-older-than: 7
- tags: {}
- change-request:
ignore-target-only-changes: true
- change-request: {}
- regular-branches: true
- skip-initial-build: true
- named-branches:
- exact-name:
name: 'test'
case-sensitive: true
- regex-name:
regex: 'test.*$'
case-sensitive: true
- wildcards-name:
excludes: 'testexclude'
includes: 'testinclude'
- named-branches:
- exact-name: {}
- regex-name: {}
- wildcards-name: {}
clean:
after: true
before: true
committer:
user: CI System
email: no-reply@ci.example.com
prune: true
local-branch: true
sparse-checkout:
paths:
- "path1"
- "path2"
- "path3"
shallow-clone: true
depth: 3
do-not-fetch-tags: true
disable-pr-notifications: true
refspecs:
- '+refs/heads/*:refs/remotes/@{remote}/*'
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
threads: 1
timeout: "100"
skip-notifications: true
use-author: true
wipe-workspace: true
lfs-pull: true
Requires the Branch API Plugin.
Definition of property strategies. Either named-branches or all-branches may be specified, but not both.
The view delivery pipeline module handles creation of Delivery Pipeline views. To create a delivery pipeline view specify delivery_pipeline in the view-type attribute to the Delivery Pipeline View definition. Requires the Jenkins Delivery Pipeline Plugin.
Minimal Example:
name: Test pipeline
description: Test jobs created by JJB.
view-type: delivery_pipeline
components:
- name: Test
initial-job: Test-A
Full Example:
name: Test pipeline
description: Test jobs created by JJB.
view-type: delivery_pipeline
components:
- name: Test
initial-job: Test-A
regexps:
- regexp: ^Test-A
no-of-pipelines: 1
allow-manual-triggers: yes
show-total-build-time: yes
allow-rebuild: yes
allow-pipeline-start: yes
allow-abort: yes
paging-enabled: yes
link-to-console-log: yes
The view list module handles creating Jenkins List views.
To create a list view specify list in the view-type attribute to the List View definition.
Example:
name: list-view-name01
view-type: list
description: 'Sample description'
filter-executors: true
filter-queue: true
job-name:
- job-name-1
- job-name-3
- job-name-2
- Job-name-4
columns:
- status
- weather
- job
- last-success
- last-failure
- last-duration
- build-button
- last-stable
- robot-list
- find-bugs
- jacoco
- git-branch
- favorite
- schedule-build
- priority-sorter
- build-filter
- desc
- policy-violations
- member-graph-view
- built-on
- extra-tests-total
- extra-tests-failed
- extra-tests-passed
- extra-tests-skipped
- extra-tests-format-0
- extra-tests-format-1
- extra-build-parameters
- extra-build-description
- extra-last-user-name
- extra-workspace-link
- extra-configure-button
- extra-last-output
recurse: true
status-filter: false
Example:
name: regex-example
view-type: list
description: 'description'
columns:
- status
- weather
- job
- last-success
- last-failure
- last-duration
- extra-build-parameter: MY_PARAMETER
regex: (?!test.*).*
The view nested module handles creating Jenkins Nested views.
To create a nested view specify nested in the view-type attribute to the Nested View definition.
Example:
name: NestedViewTest
view-type: nested
views:
- name: All
view-type: all
columns:
- status
- weather
The view pipeline module handles creating Jenkins Build Pipeline views. To create a pipeline view specify pipeline in the view-type attribute to the Pipeline View definition.
Requires the Jenkins Build Pipeline Plugin.
Example:
name: testBPview view-type: pipeline description: 'This is a description' filter-executors: false filter-queue: false first-job: job-one no-of-displayed-builds: 5 title: Title link-style: New Window css-Url: fake.urlfor.css latest-job-only: true manual-trigger: true show-parameters: true parameters-in-headers: true start-with-parameters: true refresh-frequency: 3 definition-header: true
Example:
name: testBPview view-type: pipeline first-job: job-one
Builders define actions that the Jenkins job should execute. Examples include shell scripts or maven targets. The builders attribute in the Job definition accepts a list of builders to invoke. They may be components defined below, locally defined macros (using the top level definition of builder:, or locally defined components found via the jenkins_jobs.builders entry point.
Example:
job:
name: test_job
builders:
- shell: "make test"
Requires the Jenkins Ansible Plugin.
The inventory file form (default path)
Inventory data, depends on inventory-type
List of extra variables to be passed to ansible. (optional)
Outdated Options for versions >= 1.0 of plugin:
Example:
---
builders:
- ansible-playbook:
playbook: "path/to/playbook.yml"
inventory-type: "path"
inventory:
path: "path/to/inventory-file"
variables:
- name: "my_variable"
value: "my_value"
OR
---
builders:
- ansible-playbook:
playbook: "path/to/playbook.yml"
inventory-type: "content"
inventory:
content: |
[all]
machine01.example.com
machine02.example.com
hosts: "masters"
tags-to-run: "ose"
tags-to-skip: "ovirt"
task-to-start-at: "Deploy application"
workers: 2
credentials-id: "0891c950-487b-4749-aa69-d87425e14459"
vault-credentials-id: "0421b950-487b-4749-aa69-d87425e14459"
sudo: true
sudo-user: "cloud-user"
unbuffered-output: false
colorized-output: true
additional-parameters: "-vvv"
variables:
- name: "complete_var"
value: "complete value"
hidden: false
- name: "empty_var"
- name: "hidden_var"
value: "Do not appear in console"
hidden: true
Example(s) versions < 1.0:
---
builders:
- ansible-playbook:
playbook: "path/to/playbook.yml"
inventory-type: "do-not-specify"
become: "yes"
become-user: "cloud-user"
host-key-checking: false
To setup this builder you can either reference the list of targets or use named parameters. Below is a description of both forms:
1) Listing targets:
After the ant directive, simply pass as argument a space separated list of targets to build.
Example to call two Ant targets:
builders: - ant: "target1 target2"
The build file would be whatever the Jenkins Ant Plugin is set to use per default (i.e build.xml in the workspace root).
2) Using named parameters:
Example specifying the build file too and several targets:
builders:
- ant:
targets: "debug test install"
buildfile: "build.xml"
properties:
builddir: "/tmp/"
failonerror: true
java-opts:
- "-ea"
- "-Xmx512m"
ant-name: "Standard Ant"
Requires the Jenkins Repository Connector Plugin.
list of artifacts to resolve
Minimal Example:
builders:
- artifact-resolver:
target-directory: foo
artifacts:
- group-id: commons-logging
artifact-id: commons-logging
version: "1.1"
Full Example:
builders:
- artifact-resolver:
fail-on-error: true
repository-logging: true
target-directory: foo
artifacts:
- group-id: commons-logging
artifact-id: commons-logging
version: "1.1"
classifier: src
extension: jar
target-file-name: comm-log.jar
- group-id: commons-lang
artifact-id: commons-lang
version: "1.2"
Example:
builders: - batch: "foo/foo.bat"
Requires the Jenkins Beaker Builder Plugin.
Example:
builders:
- beaker:
path: 'test.xml'
download-logs: true
builders:
- beaker:
content: |
<job group='product-QA'>
<whiteboard>
Apache 2.2 test
</whiteboard>
</job>
Requires the Jenkins Build Name Setter Plugin.
File Example:
builders:
- build-name-setter:
name: 'version.txt'
file: true
Macro Example:
builders:
- build-name-setter:
template: '#${BUILD_NUMBER}'
macro: true
Requires the Jenkins CloudBees Docker Build and Publish plugin.
Minimal example:
builders: - build-publish-docker-image
Full example:
builders:
- build-publish-docker-image:
docker-registry-url: Docker registry URL
image: Image string
docker-file-directory: Directory for Dockerfile
push-on-success: true
push-credentials-id: 71e4f29c-162b-40d0-85d9-3ddfba2911a0
clean-images: true
jenkins-job-delete: true
cloud: cloud
Requires the Jenkins Template Project Plugin.
Example:
builders: - builders-from: "base-build"
Minimal Example:
builders: - change-assembly-version
Full Example:
builders:
- change-assembly-version:
version: "1.2.3"
assembly-file: "AFile"
Requires the Jenkins AWS Cloudformation Plugin.
The region to run cloudformation in (required)
Example:
builders:
- cloudformation:
- name: "foo"
description: "Build the foo stack"
recipe: "foo.json"
parameters:
- "Key1=foo"
- "Key2=fuu"
timeout: 3600
access-key: "$AWS_ACCESS_KEY"
secret-key: "$AWS_SECRET_KEY"
region: us-west-2
sleep: 5
- name: "bar"
description: "Build the bar stack"
recipe: "bar.json"
parameters:
- "Key1=bar"
- "Key2=baa"
timeout: 3600
access-key: "$AWS_ACCESS_KEY"
secret-key: "$AWS_SECRET_KEY"
region: us-west-1
Requires the Jenkins CMake Plugin.
This builder is compatible with both versions 2.x and 1.x of the plugin. When specifying paramenters from both versions only the ones from the installed version in Jenkins will be used, and the rest will be ignored.
The makefile generator (default "Unix Makefiles").
KEY=VALUE
Example (Versions 2.x):
builders:
- cmake:
source-dir: 'path/to/source'
working-dir: 'path/to/build'
install-dir: 'path/to/install'
build-type: 'CustomReleaseType'
generator: 'NMake Makefiles'
installation-name: 'CMake custom install'
preload-script: 'path/to/source/cmake.preload'
other-arguments: '-DCMAKE_FIND_ROOT_PATH="path/to/something/else"'
clean-build-dir: true
build-tool-invocations:
- use-cmake: true
arguments: 'clean'
environment-variables: |
DESTDIR=${WORKSPACE}/artifacts/dir
URL=http://www.example.org/
- use-cmake: false
arguments: 'test'
environment-variables: |
RESTRICT="TRUE"
TARGET="NONE"
Example (Versions 1.x):
builders:
- cmake:
source-dir: 'path/to/source'
build-dir: 'path/to/build'
install-dir: 'path/to/install'
build-type: 'CustomReleaseType'
generator: 'NMake Makefiles'
make-command: '/usr/bin/make'
install-command: 'make new-install'
preload-script: 'path/to/source/cmake.preload'
other-arguments: '-DCMAKE_FIND_ROOT_PATH="path/to/something/else"'
custom-cmake-path: '/usr/bin/cmake'
clean-build-dir: true
clean-install-dir: true
Requires the Jenkins Conditional BuildStep Plugin.
Depending on the number of declared steps, a Conditional step (single) or a Conditional steps (multiple) is created in Jenkins.
| Condition kind | Description |
| always | Condition is always verified |
| never | Condition is never verified |
| boolean-expression | Run the step if the expression expends to a representation of true 7.0 3.5 0.0 condition-expression Expression to expand (required) 168u 168u 168u |
| build-cause | Run if the current build has a specific cause 7.0 3.5 0.0 cause The cause why the build was triggered. Following causes are supported - 7.0 USER_CAUSE build was triggered by a manual interaction. (default) SCM_CAUSE build was triggered by a SCM change. TIMER_CAUSE build was triggered by a timer. CLI_CAUSE build was triggered by via CLI interface REMOTE_CAUSE build was triggered via remote interface. UPSTREAM_CAUSE build was triggered by an upstream project. 168u Following supported if XTrigger plugin installed: 7.0 FS_CAUSE build was triggered by a file system change (FSTrigger Plugin). URL_CAUSE build was triggered by a URL change (URLTrigger Plugin) IVY_CAUSE build triggered by an Ivy dependency version has change (IvyTrigger Plugin) SCRIPT_CAUSE build was triggered by a script (ScriptTrigger Plugin) BUILDRESULT_CAUSE build was triggered by a result of another job (BuildResultTrigger Plugin) 168u exclusive-cause (bool) There might by multiple causes causing a build to be triggered, with this true, the cause must be the only one causing this build this build to be triggered. (default false) 168u 168u 168u |
| day-of-week | Only run on specific days of the week. 7.0 3.5 0.0 day-selector Days you want the build to run on. Following values are supported - 7.0 weekend Saturday and Sunday (default). weekday Monday - Friday. select-days Selected days, defined by 'days' below. days True for days for which the build should run. Definition needed only for 'select-days' day-selector, at the same level as day-selector. Define the days to run under this. 7.0 SUN Run on Sunday (default false) MON Run on Monday (default false) TUES Run on Tuesday (default false) WED Run on Wednesday (default false) THURS Run on Thursday (default false) FRI Run on Friday (default false) SAT Run on Saturday (default false) 168u 168u use-build-time (bool) Use the build time instead of the the time that the condition is evaluated. (default false) 168u 168u 168u |
| execution-node | Run only on selected nodes. 7.0 3.5 0.0 nodes (list) List of nodes to execute on. (required) 168u 168u 168u |
| strings-match | Run the step if two strings match 7.0 3.5 0.0 condition-string1 First string (optional) condition-string2 Second string (optional) condition-case-insensitive Case insensitive (default false) 168u 168u 168u |
| current-status | Run the build step if the current build status is within the configured range 7.0 3.5 0.0 condition-worst Accepted values are SUCCESS, UNSTABLE, FAILURE, NOT_BUILD, ABORTED (default SUCCESS) condition-best Accepted values are SUCCESS, UNSTABLE, FAILURE, NOT_BUILD, ABORTED (default SUCCESS) 168u 168u 168u |
| shell | Run the step if the shell command succeed 7.0 3.5 0.0 condition-command Shell command to execute (optional) 168u 168u 168u |
| windows-shell | Similar to shell, except that commands will be executed by cmd, under Windows 7.0 3.5 0.0 condition-command Command to execute (optional) 168u 168u 168u |
| file-exists | Run the step if a file exists 7.0 3.5 0.0 condition-filename Check existence of this file (required) condition-basedir If condition-filename is relative, it will be considered relative to either workspace, artifact-directory, or jenkins-home. (default 'workspace') 168u 168u 168u |
| files-match | Run if one or more files match the selectors. 7.0 3.5 0.0 include-pattern (list str) List of Includes Patterns. Since the separator in the patterns is hardcoded as ',', any use of ',' would need escaping. (optional) exclude-pattern (list str) List of Excludes Patterns. Since the separator in the patterns is hardcoded as ',', any use of ',' would need escaping. (optional) condition-basedir Accepted values are workspace, artifact-directory, or jenkins-home. (default 'workspace') 168u 168u 168u |
| num-comp | Run if the numerical comparison is true. 7.0 3.5 0.0 lhs Left Hand Side. Must evaluate to a number. (required) rhs Right Hand Side. Must evaluate to a number. (required) comparator Accepted values are less-than, greater-than, equal, not-equal, less-than-equal, greater-than-equal. (default 'less-than') 168u 168u 168u |
| regex-match | Run if the Expression matches the Label. 7.0 3.5 0.0 regex The regular expression used to match the label (optional) label The label that will be tested by the regular expression. (optional) 168u 168u 168u |
| time | Only run during a certain period of the day. 7.0 3.5 0.0 earliest-hour Starting hour (default "09") earliest-min Starting min (default "00") latest-hour Ending hour (default "17") latest-min Ending min (default "30") use-build-time (bool) Use the build time instead of the the time that the condition is evaluated. (default false) 168u 168u 168u |
| not | Run the step if the inverse of the condition-operand is true 7.0 3.5 0.0 condition-operand Condition to evaluate. Can be any supported conditional-step condition. (required) 168u 168u 168u |
| and | Run the step if logical and of all conditional-operands is true 7.0 3.5 0.0 condition-operands (list) Conditions to evaluate. Can be any supported conditional-step condition. (required) 168u 168u 168u |
| or | Run the step if logical or of all conditional-operands is true 7.0 3.5 0.0 condition-operands (list) Conditions to evaluate. Can be any supported conditional-step condition. (required) 168u 168u 168u |
Examples:
builders:
- conditional-step:
condition-kind: always
steps:
- shell: 'first command'
- shell: 'second command'
builders:
- conditional-step:
condition-kind: current-status
condition-worst: SUCCESS
condition-best: FAILURE
steps:
- shell: "sl"
builders:
- conditional-step:
condition-kind: not
condition-operand:
condition-kind: file-exists
condition-filename: mytestfile
condition-basedir: workspace
steps:
- shell: "touch $WORKSPACE/mytestfile"
builders:
- conditional-step:
condition-kind: day-of-week
day-selector: weekday
use-build-time: true
steps:
- shell: "sl"
builders:
- conditional-step:
condition-kind: day-of-week
day-selector: select-days
days:
MON: true
FRI: true
use-build-time: true
steps:
- shell: "sl"
builders:
- conditional-step:
condition-kind: time
earliest-hour: "4"
earliest-min: "15"
latest-hour: "20"
latest-min: "30"
steps:
- shell: "sl"
builders:
- conditional-step:
condition-kind: regex-match
regex: a*b
label: cadaaab
steps:
- shell: "sl"
builders:
- conditional-step:
condition-kind: or
condition-operands:
- condition-kind: num-comp
lhs: "2 + 5"
rhs: "1 + 6"
comparator: equal
condition-basedir: "jenkins-home"
- condition-kind: files-match
include-pattern:
- "inc_pattern1"
- "inc_pattern2"
exclude-pattern:
- "exc_pattern1"
- "exc_pattern2"
condition-basedir: "jenkins-home"
steps:
- shell: "sl"
builders:
- conditional-step:
condition-kind: and
condition-operands:
- condition-kind: regex-match
regex: "*abc*"
label: "dabcddabc"
- condition-kind: time
earliest-hour: "2"
earliest-min: "0"
latest-hour: "23"
latest-min: "40"
use-build-time: true
steps:
- shell: "sl"
Requires the Jenkins Config File Provider Plugin.
List of managed config files made up of three parameters
Full Example:
builders:
- config-file-provider:
files:
- file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012
target: target
variable: variable
replace-tokens: true
Minimal Example:
builders:
- config-file-provider:
files:
- file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012
Please note using the multijob-build for which-build argument requires the Multijob plugin
which build to get artifacts from (optional, default last-successful)
specifies the permalink to get when permalink is specified as which-build
Example:
builders:
- copyartifact:
project: foo
filter: "*.tar.gz"
target: /home/foo
which-build: specific-build
build-number: "123"
optional: true
flatten: true
do-not-fingerprint: true
parameter-filters: PUBLISH=true
Multijob Example:
builders:
- copyartifact:
project: foo
filter: "*.json"
target: /home/foo
which-build: multijob-build
optional: true
flatten: true
parameter-filters: PUBLISH=true
exclude: "*.txt"
result-var-suffix: "PROJECT_ABC"
Must also add a build wrapper (exclusion), specifying the resources that control the critical block. Otherwise, this will have no effect.
Requires the Jenkins Exclusion Plugin.
Example:
- wrapper:
name: critical-block-exclusion
wrappers:
- exclusion:
resources:
- myresource1
- job:
name: critical-block-example
project-type: freestyle
wrappers:
- critical-block-exclusion
builders:
- critical-block-start
- shell:
#!/bin/bash -ex
rollback-my-data-base
- critical-block-end
Must also add a build wrapper (exclusion), specifying the resources that control the critical block. Otherwise, this will have no effect.
Requires the Jenkins Exclusion Plugin.
Example:
- wrapper:
name: critical-block-exclusion
wrappers:
- exclusion:
resources:
- myresource1
- job:
name: critical-block-example
project-type: freestyle
wrappers:
- critical-block-exclusion
builders:
- critical-block-start
- shell:
#!/bin/bash -ex
rollback-my-data-base
- critical-block-end
Requires the Jenkins Description Setter Plugin.
Example:
builders:
- description-setter:
regexp: ".*(<a href=.*a>)"
description: "some description"
Requires the Jenkins Docker build publish Plugin.
The docker daemon (optional)
Registry to push to
Minimal example:
builders:
- docker-build-publish:
repo-name: 'test'
repo-tag: 'test-tag'
no-cache: true
no-force-pull: false
skip-build: false
skip-decorate: false
skip-latest: false
skip-tag: false
file-path: '/tmp/'
build-context: '/tmp/'
create-fingerprint: true
build-args: --build-arg https_proxy="http://some.proxy:port"
force-tag: true
Full example:
builders:
- docker-build-publish:
repo-name: 'test'
repo-tag: 'test-tag'
no-cache: true
no-force-pull: false
skip-build: false
skip-decorate: false
skip-latest: false
skip-tag: false
file-path: '/tmp/'
build-context: '/tmp/'
create-fingerprint: true
build-args: --build-arg https_proxy="http://some.proxy:port"
force-tag: true
registry:
url: 'https://registry.example.org'
credentials-id: 'registry-docker'
server:
uri: 'unix:///var/run/docker.sock'
credentials-id: 'docker-server'
Requires the Jenkins CloudBees Docker Hub Notification.
Minimal example:
builders: - docker-pull-image
Full example:
builders:
- docker-pull-image:
image: test-image-id
docker-registry-url: https://index.docker.io/v1/
credentials-id: 71e4f29c-162b-40d0-85d9-3ddfba2911a0
Requires the Jenkins Doxygen plugin.
Example:
builders:
- doxygen:
doxyfile: Doxyfile
install: doxygen
ignore-failure: true
unstable-warning: true
Requires the Jenkins Job DSL plugin.
Example:
builders:
- dsl:
script-text: "job { name 'dsljob' }"
ignore-existing: "true"
removed-job-action: "DISABLE"
removed-view-action: "DELETE"
lookup-strategy: "SEED_JOB"
additional-classpath: "*.jar"
builders:
- dsl:
target: "jobs/**/*.groovy"
ignore-existing: "true"
removed-job-action: "DISABLE"
removed-view-action: "DELETE"
lookup-strategy: "SEED_JOB"
additional-classpath: "*.jar"
Requires the Jenkins Fingerprint Plugin.
Full Example:
builders:
- fingerprint:
targets: module/dist/**/*.zip
Minimal Example:
builders: - fingerprint
Requires the Jenkins Github Plugin.
Example:
builders: - github-notifier
Requires the Jenkins Gradle Plugin.
Example:
builders:
- gradle:
build-file: "build.gradle"
gradle-name: "gradle-1.2"
wrapper: true
executable: true
use-root-dir: true
root-build-script-dir: ${workspace}/tests
pass-system-properties: true
pass-project-properties: true
switches:
- "-g /foo/bar/.gradle"
- "-PmavenUserName=foobar"
tasks: |
init
build
tests
Requires the Jenkins Grails Plugin.
Full Example:
builders:
- grails:
use-wrapper: true
name: grails-2.2.2
force-upgrade: true
non-interactive: true
targets: war ear
server-port: 8003
work-dir: ./grails-work
project-dir: ./project-work
base-dir: ./grails/project
properties: program.name=foo
plain-output: true
stack-trace: true
verbose: true
refresh-dependencies: true
Minimal Example:
builders:
- grails:
targets: foo
Requires the Jenkins Groovy Plugin.
Minimal Example:
builders:
- groovy:
command: "println Hello"
Full Example:
builders:
- groovy:
command: "Some command"
version: "Groovy 1.2"
parameters: "parameters"
script-parameters: "script parameters"
properties: "properties"
java-opts: "java opts"
Requires the Jenkins HTTP Request Plugin.
The http mode of the request (default GET)
Add 'Accept: foo' HTTP request headers where foo is the http content-type to accept (default NOT_SET)
list of header parameters
Example:
builders:
- http-request:
url: http://example.com/jenkinsTest
builders:
- http-request:
url: http://example.com/jenkinsTest
mode: POST
pass-build: true
content-type: TEXT_HTML
accept-type: TEXT_HTML
output-file: response_file.txt
authentication-key: authenticationkey
console-log: true
time-out: 10
valid-response-codes: 100:399
valid-response-content: foo
custom-headers:
- name: header
value: value
- name: header2
value: value2
Requires the Jenkins EnvInject Plugin.
Example:
builders:
- inject:
properties-file: example.prop
properties-content: EXAMPLE=foo-bar
script-file: script.sh
script-content: script content
Requires the Jenkins Jira Issue Updater Plugin.
Minimal Example:
builders:
- jenkins-jira-issue-updater:
username: 'Username'
password: 'Password'
jql: 'jql'
Full Example:
builders:
- jenkins-jira-issue-updater:
base-url: url
username: your-username
password: your-password
jql: project-key
workflow: workflow-name
comment: comment
custom-Id: ID
custom-value: value
fail-if-error: true
fail-if-no-match: true
fail-if-no-connection: true
Requires the Jenkins JMS Messaging Plugin Pipeline Plugin.
Full Example:
builders:
- jms-messaging:
override-topic: org.centos.stage.ci.pipeline.compose.complete
provider-name: fedmsg
msg-type: Custom
msg-props: |
topic=org.centos.prod.ci.pipeline.compose.complete
username=fedora-atomic
msg-content: |
{
"build_url": "${BUILD_URL}",
"compose_url": "<full-url-to-compose>",
"build_id": "${BUILD_ID}",
"ref": "fedora/rawhide/${basearch}/atomic-host",
"rev": "<sha of the commit from dist-git>",
"namespace": "rpms",
"repo": "php-simplepie",
"status": "<success/failure/aborted>",
"test_guidance": "<comma-separated-list-of-test-suites-to-run>"
}
Minimal Example:
builders:
- jms-messaging:
provider-name: fedmsg
msg-type: CodeQualityChecksDone
msg-props: test
msg-content: test
Requires the Jenkins Keivox KMAP Private Mobile App Store Plugin.
Publish application after it has been uploaded to KMAP (default false)
Minimal Example:
builders:
- kmap:
username: user@user.com
password: password
url: http://foo.com/kmap-client/
categories: Productivity
file-path: ${WORKSPACE}/path/to/file.extension
app-name: AppName
version: b${BUILD_NUMBER}_r${SVN_REVISION}
Full Example:
builders:
- kmap:
username: user@user.com
password: password
url: http://foo.com/kmap-client/
categories: Productivity
file-path: ${WORKSPACE}/path/to/file.extension
app-name: AppName
bundle: foo.apk
version: b${BUILD_NUMBER}_r${SVN_REVISION}
description: description
icon-path: ${WORKSPACE}/target/application.png
publish-optional: true
groups: MobileUsers
users: user@user.com
notify-users: true
Requires the Jenkins Managed Scripts Plugin.
Type of managed file (default script)
Example:
builders:
- managed-script:
script-id: org.jenkinsci.plugins.managedscripts.ScriptConfig1401886156431
type: script
args:
- arg1
- arg2
builders:
- managed-script:
script-id: org.jenkinsci.plugins.managedscripts.WinBatchConfig1402391729132
type: batch
args:
- arg1
- arg2
Allows your build jobs to deploy artifacts automatically to Artifactory.
Requires the Jenkins Artifactory Plugin.
Example:
builders:
- maven-builder:
name: mvn3
pom: modules/pom.xml
goals: clean install
Requires the Jenkins Config File Provider Plugin for the Config File Provider "settings" and "global-settings" config.
Example:
builders:
- maven-target:
maven-version: Maven3
pom: parent/pom.xml
goals: clean
private-repository: true
properties:
- foo=bar
- bar=foo
java-opts:
- "-Xms512m -Xmx1024m"
- "-XX:PermSize=128m -XX:MaxPermSize=256m"
settings: mvn/settings.xml
global-settings: mvn/globalsettings.xml
CFP Example:
postbuilders:
- maven-target:
maven-version: mvn30
goals: clean verify
settings: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012
global-settings: org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig0123456789012
Requires the Jenkins :jenkins-plugins:'MSBuild Plugin <msbuild>`.
Full Example:
builders:
- msbuild:
solution-file: "MySolution.sln"
msbuild-version: "msbuild-4.0"
extra-parameters: "/maxcpucount:4"
pass-build-variables: False
continue-on-build-failure: True
unstable-if-warnings: True
Minimal Example:
builders:
- msbuild:
solution-file: MySolution.sln
Requires the Jenkins Multijob Plugin.
This builder may only be used in jenkins_jobs.modules.project_multijob.MultiJob projects.
list of projects to include in the MultiJob phase
Example:
builders:
- multijob:
name: PhaseOne
condition: SUCCESSFUL
execution-type: PARALLEL
projects:
- name: PhaseOneJobA
current-parameters: true
node-label-name: "vm_name"
node-label: "agent-${BUILD_NUMBER}"
git-revision: true
abort-all-job: true
- name: PhaseOneJobB
current-parameters: true
property-file: build.props
- multijob:
name: PhaseTwo
condition: UNSTABLE
execution-type: SEQUENTIALLY
projects:
- name: PhaseTwoJobA
current-parameters: true
predefined-parameters: foo=bar
node-parameters: true
aggregate-results: true
- name: PhaseTwoJobB
current-parameters: false
kill-phase-on: UNSTABLE
enable-condition: "${BUILDNUMBER} % 2 == 1"
restrict-matrix-project: 'JVM_VARIANT == "server"'
- multijob:
name: PhaseThree
condition: ALWAYS
projects:
- name: PhaseThreeJobA
current-parameters: true
kill-phase-on: FAILURE
- multijob:
name: PhaseFour
execution-type: PARALLEL
projects:
- name: PhaseFourJobA
retry:
max-retry: 3
strategy-path: "/PhaseFour/PhaseFourRetry.prop"
- multijob:
name: PhaseFive
projects:
- name: PhaseFiveJobA
alias: PhaseFiveJobRunA
- name: PhaseFiveJobA
alias: PhaseFiveJobRunB
Requires the Jenkins Nexus Artifact Uploader Plugin.
File Example:
builders:
- nexus-artifact-uploader:
nexus_url: 'nexus.org'
group_id: 'com.example'
artifact_id: 'artifact'
version: '1.0'
packaging: 'pom'
type: 'zip'
repository: 'my-hosted-repo'
file: '/var/lib/jenkins/workspace/my_job/result.zip'
Requires the Jenkins Nexus Platform Plugin.
Controls the stage the policy evaluation will be run against on the Nexus IQ Server (required)
Specifies an IQ Application (default manual)
Minimal Example:
builders:
- nexus-iq-policy-evaluator:
stage: 'build'
application-id: 'nexus-iq-application-id001'
Full Example:
builders:
- nexus-iq-policy-evaluator:
stage: 'stage-release'
application-type: 'selected'
application-id: 'nexus-iq-application-id002'
scan-patterns:
- '**/target/*.war'
- '**/target/*.ear'
fail-build-network-error: true
Requires the Jenkins Nexus Platform Plugin.
Minimal Example:
builders:
- nexus-repo-manager:
instance-id: Nexus-Repo-Instance
repo-id: Releases
Requires the Jenkins NodeJS Plugin.
Minimal Example:
builders:
- nodejs:
script: "console.log('Some output');"
Full Example:
builders:
- nodejs:
name: "NodeJS_8.1"
script: "console.log('Some output');"
config-id: "e3757442-7c21-4a65-a1ff-6c70f5c6df34"
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-build-verify:
api-url: https://openshift.example.local.url/
bld-cfg: front
namespace: test-build
auth-token: ose-key-buildv1
verbose: true
Minimal Example:
builders: - openshift-build-verify
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-builder:
api-url: https://openshift.example.local.url/
bld-cfg: front
namespace: test9
auth-token: ose-builder1
commit-ID: ae489f7d
verbose: true
build-name: ose-test-build
show-build-logs: true
Minimal Example:
builders: - openshift-builder
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-creator:
api-url: https://openshift.example.local.url/
jsonyaml: 'front: back'
namespace: test6
auth-token: ose-key-creator1
verbose: true
Minimal Example:
builders: - openshift-creator
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-dep-verify:
api-url: https://openshift.example.local.url/
dep-cfg: front
namespace: test6
replica-count: 4
auth-token: ose-key-dep-verify1
verbose: true
Minimal Example:
builders: - openshift-dep-verify
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-deployer:
api-url: https://openshift.example.local.url/
dep-cfg: front
namespace: test3
auth-token: ose-key-deployer1
verbose: true
Minimal Example:
builders: - openshift-deployer
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-img-tagger:
api-url: https://openshift.example.local.url/
test-tag: origin-nodejs-sample:test
prod-tag: origin-nodejs-sample:production
namespace: test5
auth-token: ose-key-img1
verbose: true
Minimal Example:
builders: - openshift-img-tagger
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-scaler:
api-url: https://openshift.example.local.url/
dep-cfg: front
namespace: test2
replica-count: 4
auth-token: ose-key-scaler1
verbose: true
Minimal Example:
builders: - openshift-scaler
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
builders:
- openshift-svc-verify:
api-url: https://openshift.example.local.url/
svc-name: front
namespace: test4
auth-token: ose-key-svc-verify1
verbose: true
Minimal Example:
builders: - openshift-svc-verify
Requires the Powershell Plugin.
Example:
builders: - powershell: "foo/foo.ps1"
Requires the Jenkins Publish over CIFS Plugin.
Example:
builders:
- publish-over-cifs:
site: 'cifs.share'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
flatten: true
Requires the Jenkins Publish over SSH Plugin.
Example:
builders:
- publish-over-ssh:
site: 'server.example.com'
target: 'dest/dir'
source: 'base/source/dir/**'
timeout: 1800000
Example:
builders: - python: 'import foobar'
Requires the Jenkins Runscope Plugin.
Minimal Example:
builders:
- runscope:
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
access-token: "123456"
Full Example:
builders:
- runscope:
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
access-token: "123456"
timeout: 123
Requires the Jenkins saltstack plugin.
Minimal Example:
builders:
- saltstack:
servername: '{{SALT_MASTER}}'
credentials: 'credentials ID'
Full Example:
builders:
- saltstack:
servername: '{{SALT_MASTER}}'
credentials: 'credentials ID'
clientinterface: runner
mods: runner_mods
setpillardata: true
pillarkey: pkey
pillarvalue: pvalue
wait: true
polltime: 10
target: '{{HOSTS}}'
targettype: list
function: pkg.update
saveoutput: true
Requires the Jenkins Sbt Plugin.
Example:
builders:
- sbt:
name: "default"
actions: "clean package"
jvm-flags: "-Xmx8G"
The scan-build report has to be generated in the directory ${WORKSPACE}/clangScanBuildReports for the publisher to find it.
Requires the Jenkins Clang Scan-Build Plugin.
Full Example:
builders:
- scan-build:
target: path/to/target
target-sdk: iphonesimulator
config: Debug
clang-install-name: Analyzer
xcode-sub-path: myProj/subfolder
workspace: workspace
scheme: SchemeName
scan-build-args: --use-analyzer Xcode
xcode-build-args: -derivedDataPath $WORKSPACE/build
report-folder: clangScanBuildReports
Minimal Example:
builders:
- scan-build:
target: path/to/target
There are two ways of configuring the builder, with a plain string to execute:
Or with a mapping that allows other parameters to be passed:
Example:
builders: - shell: "make test"
builders:
- shell:
command: "make test"
unstable-return: 3
Requires the Jenkins ShiningPanda plugin.
Building environment to set up (required).
For the python environment
For the custom environment:
For the virtualenv environment:
Common to all environments:
Nature of the command field. (default shell)
Examples:
builders:
- shining-panda:
build-environment: python
python-version: System-CPython-2.7
nature: python
command: setup.py build
ignore-exit-code: false
builders:
- shining-panda:
build-environment: custom
home: /usr/local/lib/custom-python-27
nature: xshell
command: |
cd $HOME/build
python setup.py build
ignore-exit-code: true
builders:
- shining-panda:
build-environment: virtualenv
python-version: System-CPython-2.7
nature: shell
command: python setup.py build
name: virtvenv1
clear: true
use-distribute: true
system-site-packages: true
ignore-exit-code: true
Requires the Jenkins Sonar Plugin.
Example:
builders:
- sonar:
sonar-name: Sonar
scanner-name: scanner-3.x
task: views
project: sonar-project.properties
properties: sonar.views.list=myview1,myview2
java-opts: -Xmx512m
additional-arguments: -X
WARNING: This plugin appears to be deprecated. There does not seem to be any place where it is available for download.
Try the nexus-artifact-uploader plugin instead.
Minimal Example:
builders:
- sonatype-clm:
application-name: jenkins-job-builder
Full Example:
builders:
- sonatype-clm:
value: manual
application-name: jenkins-job-builder
fail-on-clm-server-failure: true
stage: release
scan-targets: '**/*.jar'
module-excludes: '**/my-module/target/**'
advanced-options: 'test'
username: bar
password: 06XQY39LHGACt3r3kzSULg==
Requires the Jenkins SSH plugin.
Example:
builders:
- ssh-builder:
ssh-user-ip: foo@bar:22
command: echo foo
Requires the Jenkins Groovy Plugin.
Examples:
builders:
- system-groovy:
file: "test.groovy"
builders:
- system-groovy:
command: "println 'Hello'"
bindings: "EXAMPLE=foo-bar"
class-path: "file:/home/user/example.jar"
sandbox: true
Requires the Jenkins ShiningPanda plugin.
Example:
builders:
- tox:
recreate: True
Requires the Jenkins Parameterized Trigger Plugin.
Passes git revision to the triggered job (optional).
Fail builds and/or mark as failed or unstable based on thresholds. Only apply if block parameter is true (optional)
list of parameter factories
Examples:
Basic usage with yaml list of projects.
builders:
- trigger-builds:
- project:
- "foo"
- "bar"
- "baz"
current-parameters: true
Basic usage with passing svn revision through.
builders:
- trigger-builds:
- project: "build_started"
predefined-parameters:
FOO="bar"
current-parameters: true
svn-revision: true
block: true
Basic usage with passing git revision through.
builders:
- trigger-builds:
- project: "build_started"
predefined-parameters:
FOO="bar"
current-parameters: true
node-label-name: NODE
node-label: testnodes
git-revision: true
block: true
Example with all supported parameter factories.
builders:
- trigger-builds:
- project: "build_started"
predefined-parameters:
FOO="bar"
current-parameters: true
svn-revision: true
parameter-factories:
- factory: filebuild
file-pattern: propfile*.txt
- factory: binaryfile
parameter-name: filename
file-pattern: otherpropfile*.txt
- factory: counterbuild
from: 0
to: 5
step: 1
- factory: allnodesforlabel
name: parametername
node-label: labelname
ignore-offline-nodes: false
- factory: allonlinenodes
block: true
Requires the Jenkins Parameterized Remote Trigger Plugin
Please note that this plugin requires system configuration on the Jenkins Master that is unavailable from individual job views; specifically, one must add remote jenkins servers whose 'Display Name' field are what make up valid fields on the remote-jenkins-name attribute below.
Example:
builders:
- trigger-remote:
remote-jenkins-name: "http://example.jenkinsmaster.lan"
token: "BLAH"
job: "build-things"
should-fail-build: True
prevent-remote-build-queue: True
poll-interval: 5
connection-retry-limit: 5
block: true
enhanced-logging: True
property-file: '.props'
predefined-parameters: |
FOO="bar"
herp="derp"
Requires the Jenkins Xcode Plugin.
Example:
builders:
- xcode
- xcode:
developer-profile: "849b07cd-ac61-4588-89c8-b6606ee84946"
clean-build: true
clean-test-reports: true
configuration: Distribution
target: TARGET
sdk: iphonesimulator
build-arguments: "test ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone 6' -derivedDataPath ."
schema: "UASDKInternal"
workspace: "UA"
profile: "PROFILE"
codesign-id: "iPhone Distribution: MapMyFitness Inc."
allow-failing: true
version-technical: "TECHNICAL"
version-marketing: "MARKETING"
ipa-export-method: ad-hoc
ipa-version: "${VERSION}"
ipa-output: "/output"
compile-bitcode: false
upload-bitcode: false
upload-symbols: false
development-team-id: foo
keychain-path: "/Users/jenkins/Library/Keychains/jenkins-uasdk-ios-pre_review"
keychain-password: "testpass"
keychain-unlock: true
provisioning-profiles:
- bundle-id: foo
provisioning-profile-uuid: bar
- bundle-id: foo2
provisioning-profile-uuid: bar2
Requires the Jenkins xUnit Plugin.
Thresholds for both 'failed' and 'skipped' tests.
Frameworks to configure, and options. Supports the following: aunit, boosttest, checktype, cpptest, cppunit, ctest, dotnettest, embunit, fpcunit, gtest, junit, mstest, nunit, phpunit, tusar, unittest, and valgrind.
The 'custom' type is not supported.
Minimal Example:
builders:
- xunit:
types:
- junit:
pattern: "junit.xml"
Full Example:
builders:
- xunit:
thresholdmode: 'percent'
thresholds:
- failed:
unstable: 0
unstablenew: 0
failure: 0
failurenew: 0
- skipped:
unstable: 0
unstablenew: 0
failure: 0
failurenew: 0
test-time-margin: 5000
types:
- phpunit:
pattern: "phpunit.log"
requireupdate: true
deleteoutput: true
skip-if-no-test-files: false
stoponerror: true
- cppunit:
pattern: "cppunit.log"
requireupdate: false
deleteoutput: false
skip-if-no-test-files: true
stoponerror: false
- gtest:
pattern: "gtest.log"
Enable HipChat notifications of build execution.
Supports hipchat plugin versions < 1.9. Will automatically redirect to the publishers module for newer versions, but still recommended that you convert to the newer module.
Deprecated since version 1.2.0: Please use 'rooms'.
Deprecated since version 1.2.0: use notify-start parameter instead
Example:
hipchat:
enabled: true
rooms:
- My Room
- Your Room
notify-start: true
notify-success: true
notify-aborted: true
notify-not-built: true
notify-unstable: true
notify-failure: true
notify-back-to-normal: true
The Metadata plugin module enables the ability to add metadata to the projects that can be exposed to job environment.
Requires the Jenkins Metadata Plugin.
Example:
metadata:
- string:
name: FOO
value: bar
expose-to-env: true
Example:
metadata:
- date:
name: FOO
value: 1371708900268
timezone: Australia/Melbourne
expose-to-env: true
Example:
metadata:
- number:
name: FOO
value: 1
expose-to-env: true
Example:
metadata:
- string:
name: FOO
value: bar
expose-to-env: true
The Notifications module allows you to configure Jenkins to notify other applications about various build phases. It requires the Jenkins notification plugin.
Requires the Jenkins Notification Plugin.
Example:
notifications:
- http:
url: http://example.com/jenkins_endpoint
format: xml
event: completed
timeout: 40000
log: -1
retries: 5
The Parameters module allows you to specify build parameters for a job.
Example:
job:
name: test_job
parameters:
- string:
name: FOO
default: bar
description: "A parameter named FOO, defaults to 'bar'."
Requires the Jenkins Active Choices Plug-in.
Use a Groovy script to define the parameter.
Use a Fallback script. If the script (specified above) fails, the fallback script will be used as a fallback.
type of the choices. (default 'single-select')
Minimal Example:
- job:
name: active-choices-job
parameters:
- active-choices:
name: lorem
Full Example:
- job:
name: active-choices-job
parameters:
- active-choices:
name: lorem
description: ipsum
script:
groovy: |-
return [
'param1',
'param2'
]
use-groovy-sandbox: false
script-additional-classpath:
- file:/jar-file-path
- file:/jar-file-path2
fallback-script:
groovy: |-
return [
'param3',
'param4'
]
use-groovy-sandbox: false
script-additional-classpath:
- file:/jar-file-path
- file:/jar-file-path2
choice-type: multi-select
enable-filters: true
filter-starts-at: 1
Requires the Jenkins Active Choices Plug-in.
Use a Groovy script to define the parameter.
Use a Fallback script. If the script (specified above) fails, the fallback script will be used as a fallback.
type of the choices. (default 'single-select')
Minimal Example:
- job:
name: active-choices-job
parameters:
- active-choices-reactive:
name: foo
Full Example:
- job:
name: active-choices-job
parameters:
- active-choices-reactive:
name: lorem
description: ipsum
script:
groovy: |-
return [
'param1',
'param2'
]
use-groovy-sandbox: false
script-additional-classpath:
- file:/jar-file-path
- file:/jar-file-path2
fallback-script:
groovy: |-
return [
'param3',
'param4'
]
use-groovy-sandbox: false
script-additional-classpath:
- file:/jar-file-path
- file:/jar-file-path2
choice-type: multi-select
enable-filters: true
filter-starts-at: 1
referenced-parameters: foo,bar
Example:
parameters:
- bool:
name: FOO
default: false
description: "A parameter named FOO, defaults to 'false'."
Example:
parameters:
- choice:
name: project
choices:
- nova
- glance
description: "On which project to run?"
Requires the Jenkins Copy Artifact plugin.
Example:
parameters:
- copyartifact-build-selector:
name: BUILD_SELECTOR
which-build: workspace-latest
description: 'Which build from upstream to copy artifacts from'
Requires the Jenkins Credentials Plugin.
credential type (optional, default 'any')
Example:
parameters:
- credentials:
name: OS_CREDENTIALS
type: usernamepassword
default: "default-credentials-id"
description: "Test credentials"
Requires the Jenkins Jenkins Dynamic Parameter Plug-in.
Example:
parameters:
- dynamic-choice:
name: OPTIONS
description: "Available options"
script: "['optionA', 'optionB']"
remote: false
read-only: false
Requires the Jenkins Jenkins Dynamic Parameter Plug-in.
parameters to corresponding script
Example:
parameters:
- dynamic-choice-scriptler:
name: OPTIONS
description: "Available options"
script-id: "scriptid.groovy"
parameters:
- name: param1
value: value1
- name: param2
value: value2
remote: false
read-only: false
Requires the Jenkins Active Choices Plug-in.
Use a Groovy script to define the parameter.
Use a Fallback script. If the script (specified above) fails, the fallback script will be used as a fallback.
type of the choices. (default 'input-text-box')
Minimal Example:
- job:
name: dynamic-reference-job
parameters:
- dynamic-reference:
name: lorem
Full Example:
- job:
name: dynamic-reference-job
folder: unochoice
parameters:
- dynamic-reference:
name: lorem
description: ipsum
script:
groovy: |-
return [
'param1',
'param2'
]
use-groovy-sandbox: false
script-additional-classpath:
- file:/path
- file:/path2
fallback-script:
groovy: |-
return [
'param3',
'param4'
]
use-groovy-sandbox: false
script-additional-classpath:
- file:/path
- file:/path2
choice-type: numbered-list
omit-value-field: True
referenced-parameters: dolor
Requires the Jenkins Jenkins Dynamic Parameter Plug-in.
Example:
parameters:
- dynamic-string:
name: FOO
description: "A parameter named FOO, defaults to 'bar'."
script: "bar"
remote: false
read-only: false
Requires the Jenkins Jenkins Dynamic Parameter Plug-in.
parameters to corresponding script
Example:
parameters:
- dynamic-string-scriptler:
name: FOO
description: "A parameter named FOO, defaults to 'bar'."
script-id: "scriptid.groovy"
parameters:
- name: param1
value: value1
- name: param2
value: value2
remote: false
read-only: false
Requires the Jenkins Extended Choice Parameter Plugin.
Minimal Example:
parameters:
- extended-choice:
name: OPTIONS
description: "Available options"
type: 'PT_CHECKBOX'
value: OptionA,OptionB,OptionC
Full Example:
parameters:
- extended-choice:
name: OPTIONS_VALUE
description: "Available options"
property-key: key
quote-value: true
type: multi-select
value: "foo|bar|select"
visible-items: 2
multi-select-delimiter: '|'
default-value: foo
default-property-key: fookey
- extended-choice:
name: OPTIONS_FILE
description: "Available options"
property-file: /home/foo/property.prop
property-key: key
quote-value: true
type: multi-select
visible-items: 2
multi-select-delimiter: '|'
default-property-file: /home/property.prop
default-property-key: fookey
- extended-choice:
name: OPTIONS_CHECKBOX
type: checkbox
value: !join:
- ','
-
- OptionA
- OptionB
- OptionC
visible-items: 2
- extended-choice:
name: MULTISELECTOPTIONS
description: "Available options"
property-key: key
quote-value: true
type: multi-select
value: !join:
- '|'
-
- foo
- bar
- select
visible-items: 2
multi-select-delimiter: '|'
default-value: foo
- extended-choice:
name: JSON
type: json
groovy-script: >-
import net.sf.json.JSONObject;
def jsonEditorOptions = JSONObject.fromObject(/{schema:
{"type": "object", "title": "Name", "properties":
{"name": {"type": "string", "propertyOrder" : 1}}}}/);
- extended-choice:
name: MULTILEVELMULTISELECT
type: multi-level-multi-select
value: !join:
- ','
-
- foo
- bar
- baz
- extended-choice:
name: MULTILEVELSINGLESELECT
type: multi-level-single-select
value: foo
Example:
parameters:
- file:
name: test.txt
description: "Upload test.txt."
Requires the Jenkins Git Parameter Plugin.
The type of the list of parameters (default 'PT_TAG')
Mode of sorting. (default 'NONE')
Which value is selected, after loaded parameters. If you choose 'default', but default value is not present on the list, nothing is selected. (default 'NONE')
Minimal Example:
parameters:
- git-parameter:
name: Foo
Full Example:
parameters:
- git-parameter:
name: Foo
description: Lorem ipsum dolor sit amet.
type: PT_BRANCH_TAG
branch: baz
tagFilter: bam
branchFilter: boo
sortMode: ASCENDING
defaultValue: bor
selectedValue: TOP
useRepository: buh
quickFilterEnabled: true
Requires the Jenkins Hidden Parameter Plugin.
Example:
parameters:
- hidden:
name: FOO
default: bar
description: A parameter named FOO, defaults to 'bar'
Example:
parameters:
- label:
name: EXAMPLE LABEL 1
description: "EXAMPLE LABEL DESCRIPTION 1"
matching-label: "success"
node-eligibility: "all"
Requires the Jenkins Matrix Combinations Plugin.
Example:
parameters:
- matrix-combinations:
name: FOO
description: "Select matrix combinations"
filter: "platform == foo"
Requires the Jenkins Maven Metadata Plugin.
Example:
parameters:
- maven-metadata:
name: 'maven metadata param'
repository-base-url: 'http://nexus.example.com'
repository-username: 'username'
repository-password: 'password'
artifact-group-id: 'com.example'
artifact-id: 'example'
packaging: 'jar'
versions-filter: '[0-9]+'
default-value: 'FIRST'
maximum-versions-to-display: "5"
sorting-order: "Ascending"
Example:
parameters:
- node:
name: SLAVE_NAME
description: "Select slave"
allowed-slaves:
- slave001
- slave002
- slave003
ignore-offline-nodes: true
allowed-multiselect: true
Example:
parameters:
- parameter-separator:
name: lorem
separator-style: FOO
section-header: bar
section-header-style: font-weight:bold;z-index:10000
Example:
parameters:
- password:
name: FOO
default: 1HSC0Ts6E161FysGf+e1xasgsHkgleLh09JUTYnipPvw=
description: "A parameter named FOO."
Requires the Jenkins Promoted Builds Plugin.
Example:
parameters:
- promoted:
name: FOO
project-name: "foo-build"
promotion-name: "passed-promotion"
description: "Select a foo-build for promotion"
Requires the Jenkins Random String Parameter Plugin.
Example:
parameters:
- random-string:
name: job-string
description: "A random string passed to the job"
failed-validation-message: "Your input string is invalid"
Example:
parameters:
- run:
name: FOO
project-name: "foo-build"
description: "Select a foo-build for promotion"
Example:
parameters:
- string:
name: FOO
default: bar
description: "A parameter named FOO, defaults to 'bar'."
trim: true
Requires the Jenkins Parameterized Trigger Plugin.
Example:
parameters:
- svn-tags:
name: BRANCH_NAME
default: release
description: A parameter named BRANCH_NAME default is release
url: http://svn.example.org/repo
filter: [A-za-z0-9]*
Example:
parameters:
- text:
name: FOO
default: bar
description: "A parameter named FOO, defaults to 'bar'."
Requires the Jenkins Validating String Plugin.
Example:
parameters:
- validating-string:
name: FOO
default: bar
description: "A parameter named FOO, defaults to 'bar'."
regex: [A-Za-z]*
msg: Your entered value failed validation
The Properties module supplies a wide range of options that are implemented as Jenkins job properties.
Example:
job:
name: test_job
properties:
- github:
url: https://github.com/openstack-infra/jenkins-job-builder/
Deprecated since version 0.1.0.: Please use authorization.
Example:
properties: - authenticated-build
Example:
properties:
- authorization:
admin:
- credentials-create
- credentials-delete
- credentials-manage-domains
- credentials-update
- credentials-view
- job-build
- job-cancel
- job-configure
- job-delete
- job-discover
- job-move
- job-read
- job-status
- job-workspace
- ownership-jobs
- run-delete
- run-replay
- run-update
- scm-tag
anonymous:
- job-read
- job-extended-read
A batch task consists of a shell script and a name. When you execute a build, the shell script gets run on the workspace, just like a build. Batch tasks and builds "lock" the workspace, so when one of those activities is in progress, all the others will block in the queue.
Requires the Jenkins Batch Task Plugin.
Example:
properties:
- batch-tasks:
- name: release
script: mvn -B release:prepare release:perform
- name: say hello
script: echo "Hello world"
Requires the Jenkins Branch API Plugin.
The time period within which the maximum number of builds will be enforced. (default 'Hour')
Minimal Example:
properties: - branch-api
Full example:
properties:
- branch-api:
time-period: Day
number-of-builds: 5
skip-rate-limit: true
Requires the Jenkins Build Blocker Plugin.
Example:
Minimal Example:
properties:
- build-blocker:
blocking-jobs:
- ".*-deploy"
Full Example:
properties:
- build-blocker:
use-build-blocker: true
blocking-jobs:
- ".*-deploy"
- "^maintenance.*"
block-level: 'NODE'
queue-scanning: 'BUILDABLE'
Example:
properties:
- build-discarder:
days-to-keep: 42
num-to-keep: 43
artifact-days-to-keep: 44
artifact-num-to-keep: 45
properties:
- build-discarder
Requires the Jenkins Builds chain fingerprinter Plugin.
Example:
properties:
- builds-chain-fingerprinter:
per-builds-chain: true
per-job-chain: true
Requires the Jenkins: Cachet Gate Plugin.
Example:
properties:
- cachet-gating:
required-resources: true
resources:
- beaker
- brew
Requires the Jenkins Copy Artifact plugin.
Example:
properties:
- copyartifact:
projects: foo*
Minimal Example:
properties: - delivery-pipeline
Full Example:
properties:
- delivery-pipeline:
stage: Stage
task: Task
description: Task-Description
Requires the Jenkins Pipeline Job Plugin.
Example:
properties: - disable-resume
Requires the Jenkins Disk Usage Plugin.
Example:
properties: - disk-usage
Minimal Example:
properties: - docker-container
Full Example:
properties:
- docker-container:
commit-on-success: true
additional-tag: latest
push-on-success: true
clean-local-images: true
docker-registry-url: https://index.docker.io/v1/
credentials-id: 71e4f29c-162b-40d0-85d9-3ddfba2911a0
Requires the Jenkins GitBucket Plugin.
Minimal Example:
properties:
- gitbucket:
url: https://foo.com
Full Example:
properties:
- gitbucket:
url: https://foo.com
link-enabled: true
Minimal Example:
properties:
- github:
url: https://github.com/openstack-infra/jenkins-job-builder/
Full Example:
properties:
- github:
url: https://github.com/openstack-infra/jenkins-job-builder/
display-name: foo
Requires the Jenkins GitLab Plugin.
Example:
properties:
- gitlab:
connection: gitlab-connection
Requires the Jenkins GitLab Logo Plugin.
Example:
properties:
- gitlab-logo:
repository-name: gitlab-repository-name
Requires the Jenkins Gogs Plugin.
Minimal Example:
properties: - gogs
Full Example:
properties:
- gogs:
branch-filter: 'master'
secret: 'yoursecret'
Requires the Jenkins Groovy Label Assignment Plugin.
Return value from Groovy script is treated as Label Expression. It is treated as followings:
Minimal Example:
properties:
- groovy-label
Full Example:
properties:
- groovy-label:
script: "$LABEL_NAME"
sandbox: true
classpath:
- "file:/minimal/absolute/path/to/file.jar"
- "file:///traditional/absolute/path/to/file.jar"
- "http://example.org/path/to/file.jar"
- "https://example.org/path/to/file.jar"
Requires the Jenkins Heavy Job Plugin.
Example:
properties:
- heavy-job:
weight: 2
Requires the Jenkins EnvInject Plugin.
Example:
properties:
- inject:
properties-content: |
FOO=bar
BAZ=foobar
Requires the Jenkins Least Load Plugin.
Example:
properties:
- least-load:
disabled: False
Example:
---
properties:
- lockable-resources:
resources: "the-resource"
---
properties:
- lockable-resources:
label: "pool-1"
---
properties:
- lockable-resources:
resources: "the-resource"
var-name: "RESOURCE_NAME"
number: 10
---
properties:
- lockable-resources:
match-script: "resourceName == MY_VAR"
groovy-sandbox: true
Requires the Jenkins Naginator Plugin.
Example:
properties:
- naginator-opt-out:
opt-out: true
Requires the Jenkins: :jenkins-plugins:` Office-365-Connector Plugin <Office-365-Connector>`.
List of webhooks (required)
Example:
properties:
- office-365-connector:
webhooks:
- url: http://outlook.office.com/webhook
name: full
start-notification: true
notify-success: false
notify-aborted: true
notify-not-built: true
notify-unstable: false
notify-failure: false
notify-back-to-normal: false
notify-repeated-failure: true
timeout: 30001
macros:
- template: macro1
value: macro1_value
- template: macro2
value: macro2_value
fact-definitions:
- name: fd1
template: fd1_value
- name: fd2
template: fd2_value
Requires the Jenkins Ownership Plugin.
Example:
properties:
- ownership:
owner: foo
co-owners:
- bar
- moo
Requires the Jenkins Priority Sorter Plugin.
Example:
properties:
- priority-sorter:
priority: 3
Requires the Jenkins Promoted Builds Plugin.
Example:
properties:
- promoted-build:
names:
- "Release to QA"
- "Jane Must Approve"
Requires the Jenkins Rebuild Plugin.
Minimal Example:
properties:
- rebuild
Full Example:
properties:
- rebuild:
auto-rebuild: true
rebuild-disabled: true
Requires the Jenkins: Jenkins Gating.
Example:
properties:
- resource-gating:
resources:
- external/ci.example.com
- foo/bar/baz
Example:
properties:
- sidebar:
url: https://jenkins.debian.net/userContent/about.html
text: About jenkins.debian.net
icon: /userContent/images/debian-swirl-24x24.png
- sidebar:
url: https://jenkins.debian.net/view/reproducible
text: reproducible builds jobs
icon: /userContent/images/debian-jenkins-24x24.png
When using Slack Plugin version < 2.0, Slack Plugin itself requires a publisher aswell as properties please note that you have to add the publisher to your job configuration aswell. When using Slack Plugin version >= 2.0, you should only configure the publisher.
Example:
properties:
- slack:
room: dummy, dummy2
notify-start: true
notify-success: true
Requires the Jenkins Slave Prerequisites Plugin.
Example:
properties:
- slave-prerequisites:
script: |
#!/bin/bash
AVAILABLE=$(df -BG --output=avail / | tail -1)
test ${AVAILABLE%G} -ge 10
properties:
- slave-prerequisites:
interpreter: cmd
script: |
@echo off
if exist C:\Jenkins\workspace.lock exit /b 1
Requires the Jenkins Slave Utilization Plugin.
Example:
properties:
- slave-utilization:
slave-percentage: 40
single-instance-per-slave: false
Example:
properties:
- speed-durability:
hint: performance-optimized
Requires the Jenkins Throttle Concurrent Builds Plugin.
Example:
properties:
- throttle:
max-per-node: 2
max-total: 4
categories:
- cat1
- cat2
option: category
matrix-builds: false
matrix-configs: true
Requires the Jenkins ZMQ Event Publisher.
Example:
properties: - zeromq-event
Publishers define actions that the Jenkins job should perform after the build is complete.
Requires the Jenkins Build Flow Test Aggregator Plugin.
Example:
publishers:
- aggregate-flow-tests:
show-test-results-trend: false
Example:
publishers:
- aggregate-tests:
include-failed-builds: true
Minimal Example:
publishers:
- allure:
results-paths:
- path: 'build/allure-results'
Full Example:
publishers:
- allure:
results-paths:
- path: 'build/allure-results1'
- path: 'build/allure-results2'
properties:
- key: 'allure.link.issue.pattern'
value: 'http://test.tms/{}'
jdk: openjdk1.8
commandline: allure2
report-build-policy: UNSTABLE
include-properties: true
Example:
publishers:
- archive:
artifacts: '*.tar.gz'
allow-empty: 'true'
fingerprint: true
default-excludes: false
Requires the Jenkins ArtifactDeployer Plugin.
Example:
publishers:
- artifact-deployer:
entries:
- files: '*.tar.gz'
basedir: '/opt/data'
excludes: '*tmp*'
remote: '/home/test/'
flatten: true
delete-remote: true
delete-remote-artifacts: true
fail-no-files: true
groovy-script: 'print 123'
deploy-if-fail: true
Requires the Jenkins Artifactory Plugin.
Example:
publishers:
- artifactory:
url: http://artifactory.example.net/artifactory
name: 'test'
release-repo-key: libs-release-local
snapshot-repo-key: libs-snapshot-local
publishers:
- artifactory:
url: http://artifactory.example.net/artifactory
name: 'test'
release-repo-key: libs-release-local
snapshot-repo-key: libs-snapshot-local
publish-build-info: true
discard-old-builds: true
discard-build-artifacts: true
even-if-unstable: true
run-checks: true
include-publish-artifacts: true
pass-identified-downstream: true
license-auto-discovery: true
aggregate-build-issues: true
allow-promotion-of-non-staged-builds: true
filter-excluded-artifacts-from-build: true
violation-recipients: myfake@email.com
matrix-params: []
black-duck-app-name: myapp
black-duck-app-version: '1.0'
black-duck-report-recipients: myfake@email.com
black-duck-scopes: []
black-duck-run-checks: true
black-duck-include-published-artifacts: true
auto-create-missing-component-requests: false
auto-discard-stale-component-requests: false
deploy-artifacts: true
deployment-include-patterns: []
deployment-exclude-patterns: []
env-vars-include: true
env-vars-include-patterns: []
env-vars-exclude-patterns: []
Requires the Jenkins Blame Upstream Committers Plugin.
Example:
publishers: - blame-upstream
Requires the Jenkins Build Publisher Plugin.
Minimal Example:
publishers: - build-publisher
Full Example:
publishers:
- build-publisher:
publish-unstable-builds: false
publish-failed-builds: false
days-to-keep: -1
num-to-keep: 100
Campfire notifications global default values must be configured for the Jenkins instance. Default values will be used if no specific values are specified for each job, so all config params are optional.
Example:
publishers:
- campfire:
subdomain: 'sub'
ssl: true
token: 'TOKEN'
room: 'room'
Requires the Jenkins Checkstyle Plugin (https://github.com/jenkinsci/checkstyle-plugin).
The checkstyle component accepts a dictionary with the following values:
Mark build as failed or unstable if the number of errors exceeds a threshold. (optional)
Example:
publishers:
- checkstyle:
pattern: '**/checkstyle-result.xml'
healthy: 0
unhealthy: 100
health-threshold: 'high'
thresholds:
unstable:
total-high: 10
failed:
total-high: 1
Full example:
publishers:
- checkstyle:
pattern: '**/checkstyle-result.xml'
can-run-on-failed: true
should-detect-modules: true
healthy: 0
unhealthy: 100
health-threshold: 'high'
thresholds:
unstable:
total-all: 90
total-high: 80
total-normal: 70
total-low: 60
new-all: 50
new-high: 40
new-normal: 30
new-low: 20
failed:
total-all: 91
total-high: 81
total-normal: 71
total-low: 61
new-all: 51
new-high: 41
new-normal: 31
new-low: 21
default-encoding: 'utf-8'
do-not-resolve-relative-paths: true
dont-compute-new: false
use-stable-build-as-reference: true
use-delta-values: true
Requires the Jenkins ChuckNorris Plugin.
Example:
publishers: - chuck-norris
Minimal Example:
publishers:
- cifs:
site: 'cifs.share'
target: 'dest/dir'
source: 'base/source/dir/**'
Full Example:
publishers:
- cifs:
site: 'cifs.share'
target: "'dest/dir/'yyyyMMddHHmmss"
target-is-date-format: true
clean-remote: true
source: 'base/source/dir/**'
excludes: '**/*.excludedfiletype'
remove-prefix: 'base/source/dir'
fail-on-error: true
flatten: true
verbose: true
retries: 99
retry-delay: 12345
Example:
publishers: - cigame
Example:
publishers: - claim-build
Full Example:
publishers:
- clamav:
includes: '*.zip'
excludes: 'foo.zip'
Minimal Example:
publishers: - clamav
Minimal example:
publishers: - clone-workspace
Full example:
publishers:
- clone-workspace:
criteria: "Any"
archive-method: "TAR"
override-default-excludes: false
workspace-glob: "**/*.zip"
workspace-exclude-glob: "**/*.tgz"
Create services automatically (default '')
Inject environment variables
Name of service instances
Minimal example:
publishers:
- cloudfoundry:
target: https://api.stackato-rkw2.local
organization: AS
space: SimpleSpace
credentials-id: j89jk213
Full example:
publishers:
- cloudfoundry:
target: https://api.stackato-rkw2.local
organization: AS
space: SimpleSpace
credentials-id: 123
self-signed: true
reset-app: true
timeout: 240
create-services:
- name: foo-name
type: foo-type
plan: plan1
reset-service: true
- name: bar-name
type: bar-type
plan: plan2
reset-service: false
value: jenkinsConfig
manifest-file: manifest.yml
app-name: cloudfoundry
memory: 1024
host-name: cloudfoundry
instances: 5
manifest-timeout: 120
no-route: true
app-path: foo
build-pack: custom-buildpack
stack: custom-stack
command: start
domain: cloudfoundry.domain
environment-variables:
- key: key
value: value
- key: key2
value: value2
services-names:
- name: service-name
- name: service-name2
List of stacks to create
List of stacks to delete
Example:
publishers:
- cloudformation:
create-stacks:
- name: "foo"
description: "Build the foo stack"
recipe: "foo.json"
parameters:
- "Key1=foo"
- "Key2=fuu"
timeout: 3600
access-key: "$AWS_ACCESS_KEY"
secret-key: "$AWS_SECRET_KEY"
region: us-west-2
sleep: 5
- name: "bar"
description: "Build the bar stack"
recipe: "bar.json"
parameters:
- "Key1=bar"
- "Key2=baa"
timeout: 3600
access-key: "$AWS_ACCESS_KEY"
secret-key: "$AWS_SECRET_KEY"
region: us-west-1
delete-stacks:
- name: "foo"
prefix: true
region: us-west-2
access-key: "$AWS_ACCESS_KEY"
secret-key: "$AWS_SECRET_KEY"
- name: "bar"
region: us-west-1
access-key: "$AWS_ACCESS_KEY"
secret-key: "$AWS_SECRET_KEY"
Your job definition should pass to PHPUnit the --coverage-clover option pointing to a file in the workspace (ex: clover-coverage.xml). The filename has to be filled in the xml-location field.
When existent, whether the plugin should generate a HTML report. Note that PHPUnit already provide a HTML report via its --cover-html option which can be set in your builder (optional):
List of metric targets to reach, must be one of healthy, unhealthy and failing. Each metric target can takes two parameters:
Whenever a metric target is not filled in, the Jenkins plugin can fill in defaults for you (as of v0.3.3 of the plugin the healthy target will have method: 70 and statement: 80 if both are left empty). Jenkins Job Builder will mimic that feature to ensure clean configuration diff.
Minimal example:
# Test for the defaults, only xml-location is required
publishers:
- cloverphp:
xml-location: 'build/clover.xml'
Full example:
# Exercise all options with non defaults values
publishers:
- cloverphp:
xml-location: 'build/clover.xml'
html:
dir: 'html'
archive: false
metric-targets:
- healthy:
method: 80
statement: 90
- unhealthy:
method: 40
statement: 50
- failing:
method: 10
statement: 20
Example:
publishers:
- cobertura:
report-file: "/reports/cobertura/coverage.xml"
only-stable: "true"
fail-no-reports: "true"
fail-unhealthy: "true"
fail-unstable: "true"
health-auto-update: "true"
stability-auto-update: "true"
zoom-coverage-chart: "true"
source-encoding: "Big5"
targets:
- files:
healthy: 10
unhealthy: 20
failing: 30
- method:
healthy: 50
unhealthy: 40
failing: 30
Minimal Example:
publishers: - codecover
Full Example:
publishers:
- codecover:
include: ./path/report.html
min-statement: 1
max-statement: 100
min-branch: 2
max-branch: 90
min-loop: 3
max-loop: 80
min-condition: 4
max-condition: 70
A Flexible Publish list of Conditional Actions is created in Jenkins.
| Condition kind | Description |
| always | Condition is always verified |
| never | Condition is never verified |
| boolean-expression | Run the action if the expression expands to a representation of true 7.0 3.5 0.0 condition-expression Expression to expand 168u 168u 168u |
| current-status | Run the action if the current build status is within the configured range 7.0 3.5 0.0 condition-worst Accepted values are SUCCESS, UNSTABLE, FAILURE, NOT_BUILD, ABORTED condition-best Accepted values are SUCCESS, UNSTABLE, FAILURE, NOT_BUILD, ABORTED 168u 168u 168u |
| shell | Run the action if the shell command succeeds 7.0 3.5 0.0 condition-command Shell command to execute 168u 168u 168u |
| windows-shell | Similar to shell, except that commands will be executed by cmd, under Windows 7.0 3.5 0.0 condition-command Command to execute 168u 168u 168u |
| regexp | Run the action if a regular expression matches 7.0 3.5 0.0 condition-expression Regular Expression condition-searchtext Text to match against the regular expression 168u 168u 168u |
| file-exists | Run the action if a file exists 7.0 3.5 0.0 condition-filename Check existence of this file condition-basedir If condition-filename is relative, it will be considered relative to either workspace, artifact-directory, or jenkins-home. Default is workspace. 168u 168u 168u |
Single Conditional Action Example:
publishers:
- conditional-publisher:
- condition-kind: current-status
condition-worst: FAILURE
condition-best: SUCCESS
action:
- archive:
artifacts: '**/**'
allow-empty: 'true'
Multiple Conditional Actions Example (includes example of multiple actions per condition which requires v0.13 or higher of the Flexible Publish plugin):
publishers:
- conditional-publisher:
- condition-kind: always
on-evaluation-failure: run-and-mark-unstable
action:
- archive:
artifacts: '**/**'
allow-empty: 'true'
- aggregate-tests:
include-failed-builds: true
Multiple Conditional Actions Example for pre-v0.13 versions
Requires the Jenkins Copy To Slave Plugin.
Example:
publishers:
- copy-to-master:
includes:
- file1
- file2*.txt
excludes:
- file2bad.txt
Example:
publishers: - coverage
Minimal Example:
publishers:
- cppcheck:
pattern: "**/cppcheck.xml"
Full Example:
publishers:
- cppcheck:
pattern: "**/cppcheck.xml"
# the rest is optional
ignoreblankfiles: true
allow-no-report: true
# build status (new) error count thresholds
thresholds:
unstable: 5
new-unstable: 5
failure: 7
new-failure: 3
healthy: 5
unhealthy: 10
# severities which count towards the threshold, default all true
severity:
error: false
warning: false
style: false
performance: false
information: false
nocategory: false
portability: false
graph:
xysize: [600, 300]
num-builds-in-graph: 10
# which errors to display, default only sum
display:
sum: false
error: true
warning: true
style: true
performance: true
information: true
nocategory: true
portability: true
Requires the Jenkins cucumber reports.
Full example:
publishers:
- cucumber-reports:
json-reports-path: path
plugin-url-path: http://example.com/
file-include-pattern: '**/*.json'
file-exclude-pattern: badfile.txt
skipped-fails: true
pending-fails: true
undefined-fails: true
missing-fails: true
no-flash-charts: true
ignore-failed-tests: true
parallel-testing: true
failed-steps-number: 1
skipped-steps-number: 2
pending-steps-number: 3
undefined-steps-number: 4
failed-scenarios-number: 5
failed-features-number: 6
build-status: UNSTABLE
trends-limit: 7
sorting-method: ALPHABETICAL
sorting-values:
- key-value-pair:
key: classification key 1
value: classification value 1
- key-value-pair:
key: classification key 2
value: classification value 2
Minimal Example:
publishers: - cucumber-reports
Minimal example:
publishers:
- cucumber-testresult:
results: nosetests.xml
Full Example:
publishers:
- cucumber-testresult:
results: nosetests.xml
ignore-bad-steps: true
Requires the Jenkins OWASP Dependency-Check Plugin.
Mark build as failed or unstable if the number of errors exceeds a threshold. (optional)
Minimal Example:
publishers: - dependency-check
Full Example:
publishers:
- dependency-check:
pattern: '**/dependency-check-report.xml'
can-run-on-failed: true
should-detect-modules: true
healthy: 0
unhealthy: 100
health-threshold: 'high'
thresholds:
unstable:
total-all: 90
total-high: 80
total-normal: 70
total-low: 60
new-all: 50
new-high: 40
new-normal: 30
new-low: 20
failed:
total-all: 91
total-high: 81
total-normal: 71
total-low: 61
new-all: 51
new-high: 41
new-normal: 31
new-low: 21
default-encoding: 'utf-8'
do-not-resolve-relative-paths: true
dont-compute-new: false
use-previous-build-as-reference: true
use-stable-build-as-reference: true
use-delta-values: true
Requires the Jenkins Description Setter Plugin.
Minimal Example:
publishers: - description-setter
Full Example:
publishers:
- description-setter:
regexp: ".*(<a href=.*a>)"
regexp-for-failed: ".*(<a href=.*a>)"
description: "some description"
description-for-failed: "another description"
set-for-matrix: true
Requires the Jenkins Disable Failed Job Plugin.
The condition to disable the job. (required) Possible values are
Example:
publishers:
- disable-failed-job:
when-to-disable: 'Failure and Unstable'
no-of-failures: 3
Example:
publishers: - display-upstream-changes
Minimal Example: .. literalinclude:: /../../tests/ publishers/fixtures/docker-stop-container-minimal.yaml
Full Example: .. literalinclude:: /../../tests/ publishers/fixtures/docker-stop-container-full.yaml
Requires the Jenkins Downstream-Ext Plugin.
Example:
publishers:
- downstream-ext:
projects:
- foo
- bar
only-on-scm-change: true
criteria: unstable
condition: equal
Requires the Jenkins Doxygen Plugin.
Minimal Example:
publishers:
- doxygen:
doxyfile: "Doxyfile"
Full Example:
publishers:
- doxygen:
doxyfile: "Doxyfile"
slave: "doxygen-slave"
keep-all: true
folder: "build"
Requires the Jenkins DRY Plugin (https://github.com/jenkinsci/dry-plugin).
The DRY component accepts a dictionary with the following values:
Mark build as failed or unstable if the number of errors exceeds a threshold. (default '')
Example:
publishers:
- dry:
pattern: '**/cpd-result.xml'
healthy: 0
unhealthy: 100
health-threshold: 'high'
high-threshold: 50
normal-threshold: 25
thresholds:
unstable:
total-high: 10
failed:
total-high: 1
Full example:
publishers:
- dry:
pattern: '**/cpd-result.xml'
can-run-on-failed: true
should-detect-modules: true
healthy: 0
unhealthy: 100
health-threshold: 'high'
high-threshold: 20
normal-threshold: 10
thresholds:
unstable:
total-all: 90
total-high: 80
total-normal: 70
total-low: 60
new-all: 50
new-high: 40
new-normal: 30
new-low: 20
failed:
total-all: 91
total-high: 81
total-normal: 71
total-low: 61
new-all: 51
new-high: 41
new-normal: 31
new-low: 21
default-encoding: 'utf-8'
do-not-resolve-relative-paths: true
dont-compute-new: false
use-stable-build-as-reference: true
use-delta-values: true
Example:
publishers:
- email:
recipients: foo@example.com
publishers:
- email:
recipients: foo@example.com bar@example.com
notify-every-unstable-build: false
send-to-individuals: true
If using matrix projects, when to trigger
list of recipients from the predefined groups
Example:
publishers:
- email-ext:
recipients: foo@example.com, bar@example.com
reply-to: foo@example.com
content-type: html
subject: Subject for Build ${BUILD_NUMBER}
body: The build has finished
attach-build-log: false
compress-log: false
attachments: "*/foo*.log"
always: true
unstable: true
first-failure: true
first-unstable: true
not-built: true
aborted: true
regression: true
failure: true
second-failure: true
improvement: true
still-failing: true
success: true
fixed: true
fixed-unhealthy: true
still-unstable: true
pre-build: true
matrix-trigger: only-configurations
presend-script: "cancel=true"
postsend-script: "cancel=true"
save-output: true
send-to:
- developers
- requester
- culprits
- recipients
- upstream-committers
Requires the Jenkins Emotional Jenkins Plugin.
Example:
publishers: - emotional-jenkins
Requires the Jenkins FindBugs Plugin (https://github.com/jenkinsci/findbugs-plugin).
Minimal Example:
publishers: - findbugs
Full Example:
publishers:
- findbugs:
pattern: '**/findbugs.xml'
rank-priority: true
include-files: 'f,d,e,.*'
exclude-files: 'a,c,d,.*'
can-run-on-failed: true
should-detect-modules: true
healthy: 80
unhealthy: 10
use-delta-values: true
health-threshold: 'high'
thresholds:
unstable:
total-all: 90
total-high: 80
total-normal: 50
total-low: 20
new-all: 95
new-high: 85
new-normal: 55
new-low: 25
failed:
total-all: 80
total-high: 70
total-normal: 40
total-low: 10
new-all: 85
new-high: 75
new-normal: 45
new-low: 15
dont-compute-new: false
use-delta-values: true
use-previous-build-as-reference: true
use-stable-build-as-reference: true
Example:
publishers:
- fingerprint:
files: builddir/test*.xml
record-artifacts: false
Requires the Jenkins Fitnesse plugin.
Example:
publishers:
- fitnesse:
results: "fitnesse-results/**/*.xml"
Requires the Jenkins Flowdock Plugin.
Example:
publishers:
- flowdock:
token: abcdefghijklmnopqrstuvwxyzabcdef
Full example:
publishers:
- flowdock:
token: abcdefghijklmnopqrstuvwxyzabcdef
tags: jenkins,ci
chat-notification: true
notify-success: true
notify-failure: true
notify-fixed: true
notify-unstable: false
notify-aborted: false
notify-notbuilt: false
Minimal Example:
publishers:
- ftp:
site: 'ftp.example.com'
target: 'dest/dir'
source: 'base/source/dir/**'
Full Example:
publishers:
- ftp:
site: 'ftp.example.com'
target: "'dest/dir/'yyyyMMddHHmmss"
target-is-date-format: true
clean-remote: true
source: 'base/source/dir/**'
excludes: '**/*.excludedfiletype'
remove-prefix: 'base/source/dir'
fail-on-error: true
flatten: true
verbose: true
retries: 99
retry-delay: 12345
List of files to upload
Minimal Example:
publishers:
- ftp-publisher:
site-name: foo
Full Example:
publishers:
- ftp-publisher:
uploads:
- file-path: destination/folder
source-file: folder/dist/*.jar
- file-path: foo/bar
source-file: foo/bar/*.ear
site-name: foo
use-timestamps: true
flatten-files: true
skip-publishing: true
Example:
publishers: - gatling
Requires the Jenkins Git Plugin.
tags to push at the completion of the build
branches to push at the completion of the build
notes to push at the completion of the build
Minimal Example:
publishers: - git
Full Example:
publishers:
- git:
push-merge: true
push-only-if-success: false
force-push: true
tags:
- tag:
remote: tagremotename
name: tagname
message: "some tag message"
create-tag: true
update-tag: true
branches:
- branch:
remote: branchremotename
name: "some/branch"
notes:
- note:
remote: remotename
message: "some note to push"
namespace: notenamespace
replace-note: true
Example:
publishers: - github-notifier
Requires the Jenkins GitHub pull request builder plugin.
Full Example:
publishers:
- github-pull-request-merge:
only-admins-merge: true
disallow-own-code: true
merge-comment: 'my fancy commit message'
fail-on-non-merge: true
delete-on-merge: true
Minimal Example:
publishers: - github-pull-request-merge
Minimal Example:
publishers: - gitlab-message
Full Example:
publishers:
- gitlab-message:
failure-only: true
success-note: true
success-note-text: "SUCCESS"
failure-note: true
failure-note-text: "Build was failed. See log on Jenkins"
abort-note: true
abort-note-text: "Build was aborted"
unstable-note: true
unstable-note-text: "The build is unstable"
Minimal Example:
publishers: - gitlab-notifier
Full Example:
publishers:
- gitlab-notifier:
name: foobar-jenkins
mark-unstable-as-success: true
Example:
publishers: - gitlab-vote
Apart from the Google Cloud Storage Plugin itself, installation of Google OAuth Credentials and addition of required credentials to Jenkins is required.
Example:
publishers:
- google-cloud-storage:
credentials-id: 'myCredentials'
uploads:
- expiring-elements:
bucket-name: 'gs://myBucket'
days-to-retain: 7
Full example:
publishers:
- google-cloud-storage:
credentials-id: 'myCredentials'
uploads:
- expiring-elements:
bucket-name: 'gs://myBucket'
days-to-retain: 7
- build-log:
log-name: 'console.log'
storage-location: 'gs://myBucket'
upload-for-failed-jobs: true
share-publicly: true
- classic:
file-pattern: 'target/*.war'
storage-location: 'gs://myBucket'
upload-for-failed-jobs: true
- classic:
file-pattern: '**/build/*.iso'
storage-location: 'gs://myBucket/artifacts/'
share-publicly: true
strip-prefix: 'path/to/'
Please pay attention on version of plugin you have installed. There were incompatible changes between 1.x and 2.x. Please see home page of this plugin for full information including migration process.
Example:
publishers:
- groovy-postbuild:
script: "manager.buildFailure()"
classpath:
- "file:///path/to/your/lib"
- "file:///path/to/your/lib"
on-failure: "failed"
matrix-parent: true
Minimal Example:
publishers:
- growl:
ip: foo.ip.address
Full Example:
publishers:
- growl:
ip: foo.ip.address
notify-only-on-fail-or-recovery: true
Please see documentation for older plugin version https://jenkins-job-builder.readthedocs.io/en/latest/hipchat.html
Example:
publishers:
- hipchat:
token: auth
rooms:
- room1
- room2
notify-start: true
notify-aborted: true
start-message: job started
complete-message: job completed
Requires the Jenkins Micro Focus Application Automation Tools.
Minimal example using defaults:
publishers:
- hp-alm:
server-name: HP-ALM
domain: FOO_COMPANY
project: foo_project
folder: 'ALM/foo/release1/test_case1'
set-folder: 'ALM/foo/release1/test_case1/$env'
testing-result-file: '**/junitResult.xml'
Full example:
publishers:
- hp-alm:
server-name: HP-ALM
credentials-id: cba09876-4321-4567-890a-bcde12345678
domain: FOO_COMPANY
project: foo_project
client-type: foo_client
testing-framework: JUnit
testing-tool: foo_tool
folder: 'ALM/foo/release1/test_case1'
set-folder: 'ALM/foo/release1/test_case1/$env'
testing-result-file: '**/junitResult.xml'
jenkins-server-url: 'http://myjenkinsserver.test.com:8080'
Requires the Jenkins HTML Publisher Plugin.
Example:
publishers:
- html-publisher:
name: "some name"
dir: "path/"
files: "index.html"
keep-all: true
allow-missing: true
link-to-last-build: true
Requires the Jenkins hue-light Plugin.
Full Example:
publishers:
- hue-light:
light-id: 123
pre-build: yellow
good-build: red
unstable-build: blue
bad-build: green
Minimal Example:
publishers:
- hue-light:
light-id: 123
Example:
publishers:
- image-gallery:
- gallery-type: archived-images-gallery
title: Gallery 1
includes: path/images
image-width: 100
unstable-if-no-artifacts: true
- gallery-type: in-folder-comparative-gallery
title: Gallery 2
base-root-folder: path/images2
image-width: 321
image-inner-width: 111
unstable-if-no-artifacts: false
- gallery-type: multiple-folder-comparative-gallery
title: Gallery 3
base-root-folder: path/images3
image-width: 222
image-inner-width: 1
Requires the Jenkins IRC Plugin.
When to send notifications
Channel Notification Message.
list channels definitions If empty, it takes channel from Jenkins configuration. (default empty) WARNING: the IRC plugin requires the channel to be configured in the system wide configuration or the jobs will fail to emit notifications to the channel
notify for matrix projects instant-messaging-plugin injects an additional field in the configuration form whenever the project is a multi-configuration project
Minimal Example:
publishers: - ircbot
Full Example:
publishers:
- ircbot:
strategy: failure-and-fixed
notify-start: true
notify-committers: true
notify-culprits: true
notify-upstream: true
notify-fixers: true
message-type: summary
channels:
- name: '#jenkins-channel1'
password: secrete
notify-only: false
- name: '#jenkins-channel2'
notify-only: true
matrix-notifier: all
When to send notifications (default all)
Channel notification message (default summary-scm)
Minimal Example:
publishers: - jabber
Full Example:
publishers:
- jabber:
notify-on-build-start: true
notify-scm-committers: true
notify-scm-culprits: true
notify-upstream-committers: true
notify-scm-fixers: true
group-targets:
- "foo-room@conference-2-fooserver.foo.com"
individual-targets:
- "foo-user@conference-2-fooserver.foo.com"
strategy: new-failure-fixed
message: summary
Minimal Example:
publishers: - jacoco
Full Example:
publishers:
- jacoco:
exec-pattern: '**/**.exec'
class-pattern: '**/classes'
source-pattern: '**/src/main/java'
source-inclusion-pattern: '**/*.java,**/*.kt'
update-build-status: true
inclusion-pattern: '**/*.class'
exclusion-pattern: '**/*Test*.class'
targets:
- instruction:
healthy: 7
unhealthy: 1
- branch:
healthy: 8
unhealthy: 2
- complexity:
healthy: 9
unhealthy: 3
- line:
healthy: 10
unhealthy: 4
- method:
healthy: 11
unhealthy: 5
- class:
healthy: 12
unhealthy: 6
Example:
publishers:
- javadoc:
directory: myproject/build/javadoc
keep-all-successful: true
JClouds Cloud Storage Settings must be configured for the Jenkins instance.
Example:
publishers:
- jclouds:
profile: hp
files: '*.tar.gz'
container: jenkins
basedir: test base dir
Example:
publishers:
- jdepend:
file: build/jdepend/main.xml
Requires the Jenkins JMS Messaging Plugin Pipeline Plugin.
Full Example:
publishers:
- jms-messaging:
override-topic: org.centos.stage.ci.pipeline.compose.complete
provider-name: fedmsg
msg-type: Custom
msg-props: |
topic=org.centos.prod.ci.pipeline.compose.complete
username=fedora-atomic
msg-content: |
{
"build_url": "${BUILD_URL}",
"compose_url": "<full-url-to-compose>",
"build_id": "${BUILD_ID}",
"ref": "fedora/rawhide/${basearch}/atomic-host",
"rev": "<sha of the commit from dist-git>",
"namespace": "rpms",
"repo": "php-simplepie",
"status": "<success/failure/aborted>",
"test_guidance": "<comma-separated-list-of-test-suites-to-run>"}
Minimal Example:
publishers:
- jms-messaging:
provider-name: fedmsg
msg-type: CodeQualityChecksDone
msg-props: test
msg-content: test
Example:
publishers:
- join-trigger:
projects:
- project-one
- project-two
threshold: unstable
publishers:
- trigger-parameterized-builds:
- project: archive
current-parameters: true
trigger-from-child-projects: true
trigger-with-no-params: true
- project: cleanup
current-parameters: true
trigger-with-no-params: false
Minimal example using defaults:
publishers:
- junit:
results: nosetests.xml
Full example:
publishers:
- junit:
results: nosetests-example.xml
keep-long-stdio: false
health-scale-factor: 2.0
allow-empty-results: true
skip-publishing-checks: true
skip-marking-build-unstable: true
test-stability: true
claim-build: true
measurement-plots: true
flaky-test-reports: true
junit-attachments: true
Minimal Example:
publishers:
- logparser:
parse-rules: "project-log-parser-rules.txt"
Full Example:
publishers:
- logparser:
use-project-rules: false
parse-rules: "/path/to/global-rules"
unstable-on-warning: true
fail-on-error: true
show-graphs: false
Minimal Example:
publishers: - logstash
Full Example:
publishers:
- logstash:
max-lines: 2000
fail-build: true
Example:
publishers:
- maven-deploy:
id: example
url: http://repo.example.com/maven2/
unique-version: true
deploy-unstable: false
release-env-var: TIMER
Minimal Example:
publishers:
- mqtt:
broker-url: tcp://localhost:1883
Full Example:
publishers:
- mqtt:
broker-url: tcp://localhost:1883
topic: hello
message: world
qos: EXACTLY_ONCE
retain-message: true
credentials-id: abcde
Example:
publishers:
- naginator:
rerun-unstable-builds: true
rerun-matrix-part: true
progressive-delay-increment: 5
progressive-delay-maximum: 15
max-failed-builds: 6
regular-expression: "foo"
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
publishers:
- openshift-build-canceller:
api-url: https://openshift.example.local.url/
bld-cfg: front
namespace: test-build
auth-token: ose-key-canceller1
verbose: true
Minimal Example:
publishers: - openshift-build-canceller
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
publishers:
- openshift-deploy-canceller:
api-url: https://openshift.example.local.url/
dep-cfg: front
namespace: test6
auth-token: ose-key-dep-canceller1
verbose: true
Minimal Example:
publishers: - openshift-deploy-canceller
Minimal example:
publishers: - opsgenie
Full Example:
publishers:
- opsgenie:
enable-sending-alerts: true
notify-build-start: true
api-key: "test api key"
priority: "P1"
build-starts-alerts-priority: "P2"
api-url: "another-opsgenie-instance.com"
tags: "a,b,c"
teams: "team a, team b"
Packer template option used (default global)
Minimal Example:
publishers:
- packer:
name: test name
Full Example:
publishers:
- packer:
name: test name
json-template: test template
json-template-text: test template text
add-params: additional params
use-debug: true
change-dir: change to directory
template-mode: global
file-entries:
- files:
variable-name: test var
contents: test content
- files:
variable-name: test var 2
contents: test content 2
Compare based on (default 'ART')
Minimal Example:
publishers: - performance
Full Example:
publishers:
- performance:
failed-threshold: 85
unstable-threshold: -1
unstable-response-time-threshold: "JMeterResultsOrders.jtl:2000"
failed-threshold-positive: 90.0
failed-threshold-negative: 10.0
unstable-threshold-positive: 80.0
unstable-threshold-negative: 20.0
nth-build-number: 10
mode-relative-thresholds: true
config-type: "PRT"
mode-of-threshold: true
fail-build: true
compare-build-previous: true
mode-performance-per-test-case: false
mode-thoughput: true
report:
- jmeter: "/special/file.jtl"
- junit: "/special/file.xml"
- jmeter
- junit
Requires the Jenkins Phabricator Plugin.
Example:
publishers:
- phabricator:
comment-on-success: false
uberalls-enabled: false
comment-with-console-link-on-failure: false
Use of the node-label-name or node-label parameters requires the Jenkins NodeLabel Parameter Plugin. Note: 'node-parameters' overrides the Node that the triggered project is tied to.
Passes git revision to the triggered job (optional).
Example:
publishers:
- pipeline:
project: test_project
current-parameters: true
predefined-parameters: foo=bar
publishers:
- pipeline:
projects:
- test_project
predefined-parameters: BUILD_NUM=${BUILD_NUMBER}
current-parameters: true
property-file: vars.txt
git-revision:
combine-queued-commits: true
fail-on-missing: true
file-encoding: UTF-8
boolean-parameters:
p1: true
p2: false
svn-revision: true
include-upstream: true
You can build pipeline jobs that are re-usable in different pipelines by using a Job Template to define the pipeline jobs, and variable substitution to specify the name of the downstream job in the pipeline. Job-specific substitutions are useful here (see Project).
See 'samples/pipeline.yaml' for an example pipeline implementation.
Requires the Jenkins Plot Plugin.
list data series definitions
Minimal Example:
publishers:
- plot:
- yaxis: ''
group: 'bench'
series:
- file: 'data.csv'
format: 'csv'
Full Example:
publishers:
- plot:
- title: MyPlot
yaxis: Y
width: 900
height: 1000
csv-file-name: myplot.csv
group: PlotGroup
num-builds: '1'
style: line
exclude-zero-yaxis: true
logarithmic-yaxis: true
use-description: true
keep-records: true
series:
- file: graph-me-second.properties
label: MyLabel
format: properties
- file: graph-me-first.csv
url: 'http://srv1'
inclusion-flag: 'include-by-string'
exclude: 'Column 1,Column 2,Column 3'
display-table: true
format: csv
- title: MyPlot2
yaxis: Y
csv-file-name: myplot2.csv
group: PlotGroup
style: bar
use-description: false
series:
- file: graph-me-third.xml
url: 'http://srv2'
format: xml
xpath-type: 'string'
xpath: '/*'
Requires the Jenkins PMD Plugin (https://github.com/jenkinsci/pmd-plugin).
The PMD component accepts a dictionary with the following values:
Mark build as failed or unstable if the number of errors exceeds a threshold. (optional)
Example:
publishers:
- pmd:
pattern: '**/pmd-result.xml'
healthy: 0
unhealthy: 100
health-threshold: 'high'
thresholds:
unstable:
total-high: 10
failed:
total-high: 1
Full example:
publishers:
- pmd:
pattern: '**/pmd-result.xml'
can-run-on-failed: true
should-detect-modules: true
healthy: 0
unhealthy: 100
health-threshold: 'high'
thresholds:
unstable:
total-all: 90
total-high: 80
total-normal: 70
total-low: 60
failed:
total-all: 90
total-high: 80
total-normal: 70
total-low: 60
default-encoding: 'utf-8'
Requires the Jenkins Post Build Task plugin.
operator to apply with the next match
Example:
publishers:
- post-tasks:
- matches:
- log-text: line to match
operator: AND
- log-text: line to match
operator: OR
- log-text: line to match
operator: AND
escalate-status: true
run-if-job-successful: true
script: |
echo "Here goes the task script"
Requires the Jenkins Post Build Script plugin.
Series of Batch/Shell scripts to to run
Paths to Groovy scripts
Inline Groovy
Execute any number of supported Jenkins builders.
Deprecated Options for versions < 2.0 of plugin:
The script-only-if-succeeded and bool script-only-if-failed options are confusing. If you want the post build to always run regardless of the build status, you should set them both to false.
Minimal Example:
publishers:
- postbuildscript
Full Example:
publishers:
- postbuildscript:
mark-unstable-if-failed: true
generic-script:
- file-path: '/fakepath/generic'
role: MASTER
build-on:
- SUCCESS
- UNSTABLE
- file-path: '/fakepath/generic-two'
role: SLAVE
build-on:
- NOT_BUILT
- ABORTED
- FAILURE
execute-on: matrix
groovy-script:
- file-path: '/fakepath/groovy'
role: MASTER
build-on:
- SUCCESS
- UNSTABLE
execute-on: axes
- file-path: '/fakepath/groovy-too'
role: SLAVE
build-on:
- NOT_BUILT
- ABORTED
- FAILURE
groovy:
- role: MASTER
build-on:
- SUCCESS
- UNSTABLE
execute-on: matrix
content: 'println "Hello world!"'
- role: SLAVE
build-on:
- NOT_BUILT
- ABORTED
- FAILURE
content: |
println "Hello world!"
println "Multi-line script"
builders:
- role: MASTER
build-on:
- SUCCESS
- UNSTABLE
execute-on: axes
build-steps:
- shell: 'echo "Hello world!"'
- role: SLAVE
build-on:
- NOT_BUILT
- ABORTED
- FAILURE
execute-on: both
build-steps:
- shell: 'echo "Hello world!"'
- shell: 'echo "Goodbye world!"'
Example(s) versions < 2.0:
publishers:
- postbuildscript:
generic-script:
- '/tmp/one.sh'
- '/tmp/two.sh'
groovy-script:
- '/tmp/one.groovy'
- '/tmp/two.groovy'
groovy:
- "/** This is some inlined groovy */"
- "/** Some more inlined groovy */"
script-only-if-succeeded: False
script-only-if-failed: True
mark-unstable-if-failed: True
You can also execute builders:
publishers:
- postbuildscript:
builders:
- shell: 'echo "Shell execution"'
- ant: 'ant_target'
Run once after the whole matrix (all axes) is built:
publishers:
- postbuildscript:
execute-on: 'matrix'
builders:
- shell: 'echo "Shell execution"'
Example:
publishers:
- publishers-from:
project-name: base-build
Requires the Jenkins Rich Text Publisher Plugin.
Minimal Example:
publishers:
- rich-text-publisher:
stable-text: testing
Full Example:
publishers:
- rich-text-publisher:
stable-text: the stable text
unstable-text: the unstable text
failed-text: the failed text
unstable-as-stable: false
failed-as-stable: false
parser-name: HTML
Requires the Jenkins Robot Framework Plugin.
Minimal Example:
publishers:
- robot:
output-path: reports/robot
Full Example:
publishers:
- robot:
output-path: reports/robot
log-file-link: report.html
report-html: custom-report.html
log-html: custom-log.html
output-xml: custom-output.xml
pass-threshold: 80.0
unstable-threshold: 60.0
only-critical: false
enable-cache: false
other-files:
- extra-file1.html
- extra-file2.txt
archive-output-xml: false
What commit information to include into notification message.
Optional list of attachments
Minimal example using defaults:
publishers:
- rocket:
channel: ''
Full example:
publishers:
- rocket:
channel: '#channel,@user'
abort: true
back-to-normal: true
failure: true
not-built: true
repeated-failure: true
start: true
success: true
unstable: true
trust-ssl: true
build-server: 'http://localhost:8080/'
webhook-token: 'non-secure-webhook-token'
webhook-token-credential-id: 'secret-text-id'
commit-info: 'authors-and-titles'
include-custom-message: true
include-test-log: true
include-test-summary: true
custom-message: 'Hello World!'
raw-message: true
attachments:
- title: The Black
- title: The Red
color: red
- title: The Blue
color: blue
text: The navy blue
- title: The White
title-link: title_link
title-link-download: true
message-link: message_link
color: white
text: 'All&all'
collapsed: true
author-name: author_name
author-link: author_link
author-icon: author_icon
thumb: 'http://hostname/thumb.png'
image: 'http://hostname/image.jpg'
audio: 'http://hostname/audio.mp3'
video: 'http://hostname/video.avi'
Requires the Jenkins Ruby metrics plugin.
Example:
publishers:
- ruby-metrics:
report-dir: "coverage/rcov"
target:
- total-coverage:
healthy: 80
unhealthy: 0
unstable: 0
- code-coverage:
healthy: 80
unhealthy: 0
unstable: 0
Requires the Jenkins RunDeck Plugin.
Example:
publishers:
- rundeck:
job-id: testproject:group/jobname
Full example:
publishers:
- rundeck:
job-id: testproject:group/jobname
options: |
STUFF_FOR_THE_JOB=stuff
ANOTHER_VAR=more_stuff
node-filters: dev
tag: master
wait-for-rundeck: true
fail-the-build: true
Requires the Jenkins S3 plugin.
Example:
publishers:
- s3:
s3-profile: banana
dont-wait-for-concurrent-builds: true
entries:
- destination-bucket: herp-derp
source-files: 'bargle_${BUILD_ID}.tgz'
storage-class: STANDARD
bucket-region: US_EAST_1
upload-on-failure: false
upload-from-slave: true
managed-artifacts: true
s3-encryption: true
flatten: true
metadata-tags:
- key: warbl ${garbl}
value: herp derp weevils
- key: hurrdurr
value: wharrgarbl blee ${FANCY_VARIABLE}
The scan-build report has to be generated in the directory ${WORKSPACE}/clangScanBuildReports for the publisher to find it.
Requires the Jenkins Clang Scan-Build Plugin.
Full Example:
publishers:
- scan-build:
mark-unstable: true
threshold: 50
exclude-paths: external-lib
report-folder: scan-build-report
Minimal Example:
publishers: - scan-build
Example:
publishers:
- scoverage:
report-directory: target/scala-2.10/scoverage-report/
report-file: scoverage.xml
When writing a publisher macro, it is important to keep in mind that Jenkins uses Ant's SCP Task via the Jenkins SCP Plugin which relies on FileSet and DirSet patterns. The relevant piece of documentation is excerpted below:
This means that absolute paths, e.g., /var/log/** will not work and will fail to compile. All paths need to be relative to the directory that the publisher runs and the paths have to be contained inside of that directory. The relative working directory is usually:
/home/jenkins/workspace/${JOB_NAME}
Example:
publishers:
- scp:
site: 'example.com'
files:
- target: 'dest/dir'
source: 'base/source/dir/**'
keep-hierarchy: true
copy-after-failure: true
Example:
publishers:
- shining-panda:
html-reports-directory: foo/bar/coveragepy_html_report/
It requires the sitemonitor plugin.
Minimal Example:
publishers: - sitemonitor
Full Example:
publishers:
- sitemonitor:
sites:
- url: http://foo.example.com
- url: http://bar.example.com:8080/
Requires the Jenkins Slack Plugin
When using Slack Plugin version < 2.0, Slack Plugin itself requires a publisher as well as properties please note that you have to create those too. When using Slack Plugin version >= 2.0, you should only configure the publisher.
For backward compatibility, the publisher needs to query version of the Slack Plugin. Hence the query_plugins_info parameter shouldn't be set to False in the jenkins section of the configuration file.
Example (version < 2.0):
publishers:
- slack:
room: '#builds'
team-domain: 'teamname'
auth-token: 'yourauthtoken'
auth-token-id: 'yourauthtokenid'
Minimal example (version >= 2.0):
publishers: - slack
Full example (version >= 2.10):
publishers:
- slack:
team-domain: 'teamname'
auth-token: 'yourauthtoken'
auth-token-id: 'yourauthtokenid'
build-server-url: 'http://localhost:8081'
room: '#builds'
notify-start: True
notify-success: True
notify-aborted: True
notify-not-built: True
notify-unstable: True
notify-failure: True
notify-every-failure: True
notify-back-to-normal: True
notify-repeated-failure: True
notify-regression: True
include-test-summary: True
include-failed-tests: True
commit-info-choice: 'AUTHORS_AND_TITLES'
include-custom-message: True
custom-message: 'A custom message.'
custom-message-success: 'A custom message for sucessful builds.'
custom-message-aborted: 'A custom message for aborted builds.'
custom-message-not-built: 'A custom message for not-built.'
custom-message-unstable: 'A custom message for unstable builds.'
custom-message-failure: 'A custom message for failed builds.'
auth-token-credential-id: yourauthtoken
bot-user: True
base-url: https://hooks.slack.com/services/
Requires the Jenkins SLOCCount Plugin.
Minimal Example:
publishers: - sloccount
Full Example:
publishers:
- sloccount:
report-files: sloccount.sc
charset: latin-1
builds-in-graph: 1
comment-is-code: true
ignore-build-failure: true
Requires the Jenkins Config File Provider Plugin for the Config File Provider "settings" and "global-settings" config.
This publisher supports the post-build action exposed by the Jenkins Sonar Plugin, which is triggering a Sonar Analysis with Maven.
Minimal Example:
publishers: - sonar
Full Example:
publishers:
- sonar:
installation-name: MySonar
jdk: MyJdk
branch: myBranch
language: java
root-pom: mypom.xml
private-maven-repo: true
maven-installation-name: Maven3.3.3
maven-opts: -DskipTests
additional-properties: -DsonarHostURL=http://example.com/
skip-global-triggers:
skip-when-scm-change: true
skip-when-upstream-build: true
skip-when-envvar-defined: SKIP_SONAR
settings: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012
global-settings: org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig0123456789012
Requires the Jenkins Jenkins Sounds plugin
Play on success
Minimal example using defaults:
publishers:
- sounds:
failure:
sound: EXPLODE
Full example:
publishers:
- sounds:
failure:
sound: EXPLODE
from:
- not_build
- aborted
success:
sound: Yahoo.Yodel
from:
- unstable
- success
- failure
Minimal Example:
publishers:
- ssh:
site: 'server.example.com'
target: 'dest/dir/'
source: 'base/source/dir/**'
Full Example:
publishers:
- ssh:
site: 'server.example.com'
target: "'dest/dir/'yyyyMMddHHmmss"
target-is-date-format: true
clean-remote: true
source: 'base/source/dir/**'
command: 'rm -r jenkins_$BUILD_NUMBER'
timeout: 1800000
use-pty: true
excludes: '**/*.excludedfiletype'
remove-prefix: 'base/source/dir'
fail-on-error: true
always-publish-from-master: true
flatten: true
verbose: true
retries: 99
retry-delay: 12345
Requires the Jenkins Bitbucket Server Notifier Plugin.
Minimal Example:
publishers: - stash
Full Example:
publishers:
- stash:
url: "https://mystash"
username: a
password: b
ignore-ssl: true
commit-sha1: c
include-build-number: true
Requires the Jenkins TAP Plugin.
Full Example:
publishers:
- tap:
results: puiparts.tap
fail-if-no-results: true
failed-tests-mark-build-as-failure: true
output-tap-to-console: false
enable-subtests: false
discard-old-reports: true
todo-is-failure: false
include-comment-diagnostics: true
validate-tests: true
plan-required: false
verbose: false
show-only-failures: true
Minimal Example:
publishers:
- tap:
results: puiparts.tap
Requires the Jenkins Task Scanner Plugin (https://github.com/jenkinsci/tasks-plugin).
Configure the build status and health. If the number of total or new warnings is greater than one of these thresholds then a build is considered as unstable or failed, respectively. I.e., a value of 0 means that the build status is changed if there is at least one warning found. Leave this field empty if the state of the build should not depend on the number of warnings. Note that for new warnings, you need to enable the next option (compute-new-warnings).
Minimal Example:
publishers: - tasks
Full Example:
publishers:
- tasks:
files-to-scan:
- "**/*.java"
- "**/*.c"
files-to-exclude:
- "specific/file.java"
tasks-tags-high:
- "FIXME"
- "XXX"
tasks-tags-normal:
- "TODO"
tasks-tags-low:
- "NICETOHAVE"
ignore-case: false
regular-expression: false
run-always: false
detect-module: false
health-thresholds-100: 100
health-thresholds-0: 0
health-priorities: 'low'
status-thresholds:
unstable-total-all: 0
unstable-total-high: 0
unstable-total-normal: 0
unstable-total-low: 0
failed-total-all: 0
failed-total-high: 0
failed-total-normal: 0
failed-total-low: 0
unstable-new-all: 0
unstable-new-high: 0
unstable-new-normal: 0
unstable-new-low: 0
failed-new-all: 0
failed-new-high: 0
failed-new-normal: 0
failed-new-low: 0
compute-new-warnings: false
use-delta: false
use-prev-build-as-ref: false
only-use-stable-as-ref: false
default-encoding: "UTF-8"
Requires the Jenkins Test Fairy Plugin.
Android Only:
IOS Only:
All:
Duration of the session (default 10m)
Time interval between screenshots (default 1)
Video quality (default high)
Example:
publishers:
- test-fairy:
platform: android
apikey: apikey
appfile: /tmp/appfile.apk
keystorepath: /tmp/keystorefile
publishers:
- test-fairy:
platform: android
apikey: apikey
appfile: /tmp/appfile.apk
proguard-file: /tmp/proguardfile
keystorepath: /tmp/keystorefile
storepass: android
alias: androiddebugkey
keypass: keypass
tester-groups: testergroups
notify-testers: true
autoupdate: true
publishers:
- test-fairy:
platform: ios
apikey: apikey
appfile: /tmp/appfile.ipa
publishers:
- test-fairy:
platform: ios
apikey: apikey
appfile: /tmp/appfile.ipa
dSYM-file: /tmp/dsym.zip
tester-groups: testergroups
notify-testers: true
autoupdate: true
Requires the Jenkins TestNG Results Plugin.
Full Example:
publishers:
- testng:
pattern: "**/testng-results.xml"
escape-test-description: false
escape-exception-msg: false
fail-on-failed-test-config: true
show-failed-builds: true
unstable-skips: 50
unstable-fails: 25
failed-skips: 75
failed-fails: 66
threshold-mode: number
Minimal Example:
publishers:
- testng:
pattern: "**/testng-results.xml"
Requires the Jenkins Tests Selector Plugin.
Example:
publishers:
- testselector:
name: tests
description: integration
properties-file: example.properties
enable-field: enabled
groupby: testgroup
field-separator: .
show-fields: testsuite,testcase
multiplicity-field: multiplicity
Requires the Jenkins Text-finder Plugin.
Example:
publishers:
- text-finder:
regexp: "some string"
fileset: "file.txt"
also-check-console-output: true
succeed-if-found: false
unstable-if-found: false
not-built-if-found: false
Example:
publishers:
- trigger:
project: other_job
threshold: SUCCESS
Use of the node-label-name or node-label parameters requires the Jenkins NodeLabel Parameter Plugin. Note: 'node-parameters' overrides the Node that the triggered project is tied to.
Passes git revision to the triggered job (optional).
Combine Queued git hashes. Only valid when 'git-revision' is true. (default false)
Deprecated since version 1.5.0: Please use combine-queued-commits under the git-revision argument instead.
Example:
publishers:
- trigger-parameterized-builds:
- project:
- other_job
- foo
- bar
predefined-parameters: |
foo=bar
bar=foo
- project: other_job1, other_job2
predefined-parameters: BUILD_NUM=${BUILD_NUMBER}
git-revision: true
property-file: version.prop
fail-on-missing: true
property-multiline: true
- project: yet_another_job
predefined-parameters: foo=bar
git-revision:
combine-queued-commits: true
restrict-matrix-project: label=="x86"
- project: yet_another_job_2
node-label-name: foo
- project: yet_another_job_3
node-label: node-label-foo || node-label-bar
- project: 'test-project-same-node'
node-parameters: true
current-parameters: true
publishers:
- trigger-parameterized-builds:
- project:
- other_job
- foo
- bar
boolean-parameters:
p1: true
p2: false
svn-revision: true
include-upstream: true
git-revision: true
combine-queued-commits: true
property-file: version.prop
file-encoding: UTF-8
Requires the Jenkins Valgrind Plugin.
Mark build as failed or unstable if the number of errors exceeds a threshold. All threshold values are optional.
Example:
publishers:
- valgrind:
pattern: "test.xml"
thresholds:
unstable:
invalid-read-write: 1
definitely-lost: 2
total: 3
failed:
invalid-read-write: 4
definitely-lost: 5
total: 6
fail-no-reports: true
fail-invalid-reports: true
publish-if-aborted: true
publish-if-failed: true
The violations component accepts any number of dictionaries keyed by the name of the violations system. The dictionary has the following values:
Any system without a dictionary provided will use default values.
Valid systems are:
Example:
publishers:
- violations:
pep8:
min: 0
max: 1
unstable: 1
pattern: '**/pep8.txt'
Requires the Jenkins Warnings Plugin (https://github.com/jenkinsci/warnings-plugin).
Determines which warning priorities should be considered when evaluating the build health (default all-priorities)
If the number of total warnings is greater than one of these thresholds then a build is considered as unstable or failed, respectively. (default '')
If the specified number of new warnings exceeds one of these thresholds then a build is considered as unstable or failed, respectively. (default '')
Minimal Example:
publishers: - warnings
Full Example:
publishers:
- warnings:
console-log-parsers:
- FxCop
- CodeAnalysis
workspace-file-scanners:
- file-pattern: '**/*.out'
scanner: 'AcuCobol Compiler'
- file-pattern: '**/*.warnings'
scanner: FxCop
files-to-include: '[a-zA-Z]\.java,[a-zA-Z]\.cpp'
files-to-ignore: '[a-zA-Z]\.html,[a-zA-Z]\.js'
messages-to-ignore: |-
^Test results:.*
No sources found skipping Kotlin compile
categories-to-ignore: |-
WARN.*
ERROR
run-always: true
detect-modules: true
resolve-relative-paths: true
health-threshold-high: 50
health-threshold-low: 25
health-priorities: high-and-normal
total-thresholds:
unstable:
total-all: 90
total-high: 90
total-normal: 40
total-low: 30
failed:
total-all: 100
total-high: 100
total-normal: 50
total-low: 40
new-thresholds:
unstable:
new-all: 100
new-high: 50
new-normal: 30
new-low: 10
failed:
new-all: 100
new-high: 60
new-normal: 50
new-low: 40
use-delta-for-new-warnings: true
use-previous-build-as-reference: true
only-use-stable-builds-as-reference: true
default-encoding: ISO-8859-9
Requires the Jenkins Whitesource Plugin.
Full Example:
publishers:
- whitesource:
product-token: abcdefghijklmnopqrstuvwxyzabcdef
version: 1.0.17
policies: enable
override-token: "1231424523412"
project-token: sd;fkljsdfkljasdfkj
requester-email: foo@email.com
includes:
- lib/*.jar
- test/lib/*.jar
excludes:
- lib/ant*.jar
- test/lib/ant*.jar
Minimal Example:
publishers: - whitesource
The pre-build workspace-cleanup is available as a wrapper.
clean depending on build status
Minimal Example:
publishers: - workspace-cleanup
Full Example:
publishers:
- workspace-cleanup:
include:
- "*.zip"
exclude:
- "*.txt"
clean-if:
- success: false
- unstable: false
- failure: false
- aborted: false
- not-built: false
dirmatch: true
fail-build: false
clean-parent: true
external-deletion-command: 'command'
disable-deferred-wipeout: true
Requires the Jenkins Summary Display Plugin.
Minimal Example:
publishers:
- xml-summary:
files: '*_summary_report.xml'
Full Example:
publishers:
- xml-summary:
files: '*_summary_report.xml'
shown-on-project-page: true
Thresholds for both 'failed' and 'skipped' tests.
Frameworks to configure, and options. Supports the following: aunit, boosttest, checktype, cpptest, cppunit, ctest, dotnettest, embunit, fpcunit, gtest, junit, mstest, nunit, phpunit, tusar, unittest, and valgrind.
The 'custom' type is not supported.
Example:
publishers:
- xunit:
thresholdmode: 'percent'
thresholds:
- failed:
unstable: 0
unstablenew: 0
failure: 0
failurenew: 0
- skipped:
unstable: 0
unstablenew: 0
failure: 0
failurenew: 0
types:
- phpunit:
pattern: "junit.log"
stoponerror: true
- cppunit:
pattern: "cppunit.log"
- gtest:
pattern: "gtest.log"
Reporters are like publishers but only applicable to Maven projects.
Example:
job:
name: test_job
project-type: maven
reporters:
- email:
recipients: breakage@example.com
Example:
reporters:
- email:
recipients: breakage@example.com
Requires the Jenkins FindBugs Plugin (https://github.com/jenkinsci/findbugs-plugin).
Minimal Example:
project-type: maven
reporters:
- findbugs
Full Example:
project-type: maven
reporters:
- findbugs:
rank-priority: true
include-files: 'f,d,e,.*'
exclude-files: 'a,c,d,.*'
can-run-on-failed: true
healthy: 80
unhealthy: 10
use-delta-values: true
health-threshold: 'high'
thresholds:
unstable:
total-all: 90
total-high: 80
total-normal: 50
total-low: 20
new-all: 95
new-high: 85
new-normal: 55
new-low: 25
failed:
total-all: 80
total-high: 70
total-normal: 40
total-low: 10
new-all: 85
new-high: 75
new-normal: 45
new-low: 15
dont-compute-new: false
use-delta-values: true
use-previous-build-as-reference: true
use-stable-build-as-reference: true
The SCM module allows you to specify the source code location for the project. It adds the scm attribute to the Job definition, which accepts any number of scm definitions. It is also possible to pass [] to the scm attribute. This is useful when a set of configs has a global default scm and you want to a particular job to override that default with no SCM.
The scm module allows referencing multiple repositories in a Jenkins job. Note: Adding more than one scm definition requires the Jenkins Multiple SCMs plugin.
- scm:
name: first-scm
scm:
- git:
url: ssh://jenkins@review.openstack.org:29418/first.git
branches:
- origin/master
- scm:
name: second-scm
scm:
- git:
url: ssh://jenkins@review.openstack.org:29418/second.git
branches:
- origin/master
- scm:
name: first-and-second
scm:
- first-scm
- second-scm
- job:
name: my-job
scm:
- first-and-second
scm: []
Requires the Jenkins AccuRev Plugin.
Example:
scm:
- accurev:
depot: Test depot
stream: Test stream
server-name: Test server name
ignore-parent-changes: true
clean-reference-tree: true
build-from-snapshot: true
do-not-pop-content: true
workspace: Test workspace
reference-tree: Test reference tree
directory-offset: Test directory offset
sub-path: Test sub path
filter-poll-scm: Test filter
snapshot-name-format: Test snapshot name format
Requires the Jenkins Bazaar Plugin.
The repository browser to use.
Example:
scm:
- bzr:
url: lp:test_project
Requires the Jenkins CVS Plugin.
List of CVS repositories. (required)
Example
scm:
- cvs:
repos:
- root: ":protocol:user@host1:path"
locations:
- modules:
- remote: "remote1"
- remote: "remote2"
- root: ":protocol:user@host2:path"
locations:
- modules:
- remote: "remote1"
scm:
- cvs:
repos:
- root: ":protocol:user@host1:path"
compression-level: "1"
locations:
- type: TAG
name: "tag name"
use-head: false
modules:
- remote: "remote1"
local-name: "localName"
- remote: "remote2"
excluded-regions:
- "pattern1"
- "pattern2"
- root: ":protocol:user@host2:path"
locations:
- modules:
- remote: "remote1"
use-update: false
prune-empty: false
skip-changelog: true
show-all-output: true
clean-checkout: true
clean-copy: true
Requires Jenkins Dimensions Plugin.
Default Permissions for updated files (default: DEFAULT)
End of line (default: DEFAULT)
Examples:
scm:
- dimensions:
project: myProduct:myProject
scm:
- dimensions:
project: myProduct:myProject
permissions: WRITABLE
eol: UNIX
folders:
- src
- test
exclude:
- excluded_dir
- excluded_other_dir
username: johnd
password: passw0rd
server: my.dmscm.server:1234
database: myDatabase@myDsn
update: true
clear-workspace: true
force-build: true
overwrite-modified: true
expand-vars: true
no-metadata: true
maintain-timestamp: true
slave-checkout: true
timezone: Europe/Berlin
web-url: https://my.dmscm.weburl
Requires the Jenkins Git Plugin.
list of remotes to set up (optional, only needed if multiple remotes need to be set up)
Skip tagging (default true)
Deprecated since version 2.0.0.: Please use per-build-tag extension, which has the inverse meaning.
Clean after checkout (default false)
Deprecated since version 1.1.1.: Please use clean extension format.
Disable submodules (default false)
Deprecated since version 1.1.1.: Please use submodule extension.
Recursively update submodules (default false)
what repository browser to use.
Example:
scm:
- git:
url: https://example.com/project.git
branches:
- master
- stable
browser: githubweb
browser-url: http://github.com/foo/example.git
timeout: 20
Requires the Jenkins Mercurial Plugin.
what repository browser to use
Example:
scm:
- hg:
revision: feature
url: ssh://hg@hg/repo
credentials-id: "abcdef01234567890"
modules:
- module1
- module2
clean: true
subdir: my/sources
disable-changelog: true
browser: hgweb
browser-url: http://hg/repo
Requires the Jenkins OpenShift Pipeline Plugin.
Full Example:
scm:
- openshift-img-streams:
image-stream-name: nodejs-010-fedora
tag: prod
api-url: https://openshift.example.local.url/
namespace: test-scm
auth-token: ose-key-img-streams1
verbose: true
Minimal Example:
scm: - openshift-img-streams
Requires the Jenkins P4 Plugin.
Requires the Jenkins Repo Plugin.
Example:
scm:
- repo:
manifest-url: https://example.com/project/
manifest-branch: stable
manifest-file: repo.xml
manifest-group: drivers
ignore-projects:
- static-project
- unimportant-project
destination-dir: build
repo-url: https://internal.net/projects/repo
mirror-dir: ~/git/project/
jobs: 3
current-branch: false
reset-first: true
quiet: false
force-sync: true
no-tags: true
trace: true
show-all-changes: true
local-manifest: |
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="external/project" name="org/project"
remote="gerrit" revision="master" />
</manifest>
Requires the Jenkins Visualworks Smalltalk Store Plugin.
Example:
scm:
- store:
script: someStoreScript
repository: StoreRepository
version-regex: "[0-9]+"
minimum-blessing: Integrated
parcel-builder-file: parcelBuilderInput
pundles:
- package: SomePackage
- package: AnotherPackage
- bundle: SomeBundle
optional argument to specify how to update the workspace (default wipeworkspace)
list of additional credentials (optional) :Additional-Credentials:
URL of the svn web interface (optional)
Multiple repos example:
scm:
- svn:
workspaceupdater: update
repos:
- url: http://svn.example.com/repo
basedir: .
credentials-id: "abcdef01234567890"
repo-depth: files
ignore-externals: true
- url: http://svn.example.com/repo2
basedir: repo2
Advanced commit filtering example:
scm:
- svn:
url: http://svn.apache.org/repos/asf/spamassassin/trunk
credentials-id: "abcdef01234567890"
repo-depth: empty
ignore-externals: true
workspaceupdater: wipeworkspace
included-regions:
- /region1/.*\.cpp
- /region2
excluded-regions:
- /region3/.*\.jpg
- /region4
excluded-users:
- user1
- user2
excluded-commit-messages:
- test-msg
- test-msg2
exclusion-revprop-name: propname
filter-changelog: true
ignore-property-changes-on-directories: true
viewvc-url: http://svn.apache.org/viewvc/spamassassin/trunk
Requires the Jenkins Team Foundation Server Plugin (https://github.com/jenkinsci/tfs-plugin).
NOTE: TFS Password must be entered manually on the project if a user name is specified. The password will be overwritten with an empty value every time the job is rebuilt with Jenkins Job Builder.
The name of the workspace under which the source should be retrieved. This workspace is created at the start of a download, and deleted at the end. You can normally omit the property unless you want to name a workspace to avoid conflicts on the server (i.e. when you have multiple projects on one server talking to a Team Foundation Server). (default Hudson-${JOB_NAME}-${NODE_NAME})
The TFS plugin supports the following macros that are replaced in the workspace name:
Adds links in "changes" views within Jenkins to an external system for browsing the details of those changes. The "Auto" selection attempts to infer the repository browser from other jobs, if supported by the SCM and a job with matching SCM details can be found. (optional, default Auto).
Examples:
scm:
- tfs:
server-url: "tfs.company.com"
project-path: "$/myproject"
login: "mydomain\\\\jane"
use-update: false
local-path: "../foo/"
workspace: "Hudson-${JOB_NAME}"
web-access:
- web-url: "http://TFSMachine:8080"
scm:
- tfs:
server-url: "tfs.company.com"
project-path: "$/myproject"
login: "jane@mydomain"
use-update: false
local-path: "../foo/"
workspace: "Hudson-${JOB_NAME}"
web-access:
Requires the Jenkins URL SCM.
Examples:
scm:
- url:
url-list:
- 'http://jenkins.domain.local/jnlpJars/jenkins-cli.jar'
scm:
- url:
url-list:
- 'http://jenkins.domain.local/jnlpJars/jenkins-cli.jar'
- 'http://code.jquery.com/jquery-1.11.3.min.js'
clear-workspace: true
Requires the Jenkins Clone Workspace SCM Plugin.
The job the workspace is cloned from must be configured with an clone-workspace publisher
Example:
scm:
- workspace:
parent-job: my-upstream-job
criteria: Any
Triggers define what causes a Jenkins job to start building.
Example:
job:
name: test_job
triggers:
- timed: '@daily'
Requires the Jenkins Artifactory Plugin.
Example with Single Path to Monitor:
triggers:
- artifactory:
artifactory-server: my-artifactory
schedule: H/15 * * * *
paths: myrepo/myfolder/latest
Example with Multiple Paths to Monitor:
triggers:
- artifactory:
artifactory-server: my-artifactory
schedule: H 0,8,16 * * *
paths: myrepo/myfolder/latest;myrepo/myfolder/commit
Requires the Jenkins BitBucket Plugin.
Example:
triggers: - bitbucket
Requires the Jenkins BuildResultTrigger Plugin.
Full Example:
triggers:
- build-result:
cron: H/15 * * * *
combine: true
groups:
- jobs:
- test
- test2
results:
- success
- not-built
- jobs:
- test3
results:
- unstable
Minimal Example:
triggers:
- build-result:
groups:
- jobs:
- test
results:
- aborted
Requires the Jenkins CloudBees Docker Hub Notification.
Minimal Example:
triggers: - dockerhub-notification
Full Example:
triggers:
- dockerhub-notification:
referenced-image: true
repositories:
- repo1
- repo2
Requires the Jenkins Generic Webhook Trigger.
Parameters to use from posted JSON/XML
Parameters to use passed in as request arguments
Parameters to use passed in as headers
Example:
triggers:
- generic-webhook-trigger:
post-content-params:
- type: JSONPath
key: action
value: $.action
regex-filter: value_filter
default-value: default_value
- type: XPath
key: blah
value: whooga
regex-filter: value_filer
default-value: default_something
regex-filter-text: $action
regex-filter-expression: ^(opened|reopened|synchronize)$
request-params:
- key: request_test_1
regex-filter: requesT_value_1
header-params:
- key: header_test1
regex-filter: header_value1
print-post-content: true
print-contrib-var: true
cause: Generic Cause
token: blah
silent-response: true
Requires the Jenkins Gerrit Trigger Plugin version >= 2.6.0.
Events to react on. Please use either the new trigger-on, or the old trigger-on-* events definitions. You cannot use both at once.
exclude-private|exclude-wip needs Gerrit Trigger v2.29.0 Exclude drafts|trivial-rebase|no-code-change needs Gerrit Trigger v2.12.0
Deprecated since version 1.1.0: Please use trigger-on.
Trigger on patchset upload.
Deprecated since version 1.1.0.: Please use trigger-on.
Trigger on change abandoned. Requires Gerrit Trigger Plugin version >= 2.8.0
Deprecated since version 1.1.0.: Please use trigger-on.
Trigger on change merged
Deprecated since version 1.1.0.: Please use trigger-on.
Trigger on change restored. Requires Gerrit Trigger Plugin version >= 2.8.0
Deprecated since version 1.1.0.: Please use trigger-on.
Trigger on comment added
Deprecated since version 1.1.0.: Please use trigger-on.
Trigger on draft published event
Deprecated since version 1.1.0: Please use trigger-on.
Trigger on ref-updated
Deprecated since version 1.1.0.: Please use trigger-on.
Approval category for comment added
Deprecated since version 1.1.0.: Please use trigger-on.
Approval value for comment added
Deprecated since version 1.1.0.: Please use trigger-on.
list of projects to match
Deprecated since version 1.1.0: Please use branches.
Deprecated since version 1.1.0: Please use branches.
map of build outcomes for which Jenkins must skip vote. Requires Gerrit Trigger Plugin version >= 2.7.0
If used, rules regarding cancellation of builds can be set with this option when patchsets of the same change comes in. This setting overrides global server configuration. If build-cancellation-policy is not present in YAML the global server configuration is used. Requires Gerrit Trigger Plugin version >= 2.32.0
Do not pass compound 'name and email' parameters (default false)
Deprecated since version 3.5.0: Please use name-and-email-parameter-mode parameter.
If parameters regarding multiline text, e.g. commit message, should be as human readable or not. If false, those parameters are Base64 encoded to keep environment variables clean. (default false)
Deprecated since version 3.5.0: Please use commit-message-parameter-mode parameter.
trigger patchset-created events for changes that were uploaded while connection to Gerrit was down (default false). Requires Gerrit Trigger Plugin version >= 2.11.0.
Deprecated since version 3.5.0: Supported for Gerrit Trigger Plugin versions < 2.14.0. See Missed Events Playback Feature.
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. Support for this will be removed after 1.0.0 is released.
Example:
triggers:
- gerrit:
trigger-on:
- patchset-created-event:
exclude-drafts: true
exclude-trivial-rebase: true
exclude-no-code-change: true
exclude-private: true
exclude-wip: true
commit-message-contains-regex: "regex"
- comment-added-event:
approval-category: 'APRV'
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
aborted: true
build-cancellation-policy:
abort-new-patchsets: false
abort-manual-patchsets: true
abort-same-topic: true
silent: false
silent-start: true
escape-quotes: false
dependency-jobs: 'job1, job2'
name-and-email-parameter-mode: PLAIN
notification-level: ALL
dynamic-trigger-enabled: true
dynamic-trigger-url: http://myhost/mytrigger
server-name: my-server
failure-message-file: path/to/filename
Requires the Jenkins GitHub Plugin.
Example:
triggers: - github
Requires the Jenkins GitHub Pull Request Builder Plugin.
Full Example:
triggers:
- github-pull-request:
admin-list:
- user1
- user2
white-list:
- user3
- user4
org-list:
- org1
- org2
white-list-labels:
- label1
- label2
black-list-labels:
- label3
- label4
cron: '* * * * *'
build-desc-template: "build description"
trigger-phrase: 'retest this please'
skip-build-phrase: 'no tests'
black-list-commit-author:
- blacklist
- commit
- author
only-trigger-phrase: true
github-hooks: true
permit-all: true
auto-close-on-fail: false
display-build-errors-on-downstream-builds: true
allow-whitelist-orgs-as-admins: true
white-list-target-branches:
- master
- testing
black-list-target-branches:
- master
- testing
auth-id: '123-456-789'
status-context: "status context"
triggered-status: "triggered status message"
started-status: "started"
status-url: "url/to/status"
status-add-test-results: false
success-status: "success message"
failure-status: "failure message"
error-status: "error message"
success-comment: "success comment"
failure-comment: "failure comment"
error-comment: "error-comment"
cancel-builds-on-update: true
comment-file: "/tmp/path"
no-commit-status: true
included-regions:
- include
- region
excluded-regions:
- exclude
- region
Minimal Example:
triggers: - github-pull-request
Requires the Jenkins GitLab Plugin.
Rebuild open Merge Requests on Push Events.
| Branch filter type | Description |
| All | All branches are allowed to trigger this job. |
| NameBasedFilter | Filter branches by name. List source branches that are allowed to trigger a build from a Push event or a Merge Request event. If both fields are left empty, all branches are allowed to trigger this job. For Merge Request events only the target branch name is filtered out by the include-branches and exclude-branches lists. |
| RegexBasedFilter | Filter branches by regex The target branch regex allows you to limit the execution of this job to certain branches. Any branch matching the specified pattern in target-branch-regex triggers the job. No filtering is performed if the field is left empty. |
Example (version < 1.1.26):
triggers:
- gitlab:
trigger-push: true
trigger-merge-request: true
trigger-open-merge-request-push: true
ci-skip: true
set-build-description: true
add-note-merge-request: true
add-vote-merge-request: true
add-ci-message: true
allow-all-branches: true
include-branches:
- 'master'
- 'master2'
- 'local-test'
exclude-branches:
- 'broken-test'
- 'master-foo'
Minimal example (version >= 1.1.26):
triggers: - gitlab
Full example (version >= 1.1.26):
triggers:
- gitlab:
trigger-push: false
trigger-merge-request: false
trigger-open-merge-request-push: both
ci-skip: false
set-build-description: false
add-note-merge-request: false
add-vote-merge-request: false
add-ci-message: true
allow-all-branches: true
include-branches:
- 'master'
- 'master2'
- 'local-test'
exclude-branches:
- 'broken-test'
- 'master-foo'
pending-build-name: 'test'
Requires the Jenkins Gitlab MergeRequest Builder Plugin.
Publish build progress messages (except build failed) (default true)
Deprecated since version 2.0.0.
Example (version < 2.0.0):
triggers:
- gitlab-merge-request:
cron: '* * * * *'
project-path: 'test/project'
use-http-url: false
assignee-filter: 'jenkinsbot'
tag-filter: 'fix'
trigger-comment: 'rebuild'
publish-build-progress-messages: true
auto-close-failed: false
auto-merge-passed: false
Example (version >= 2.0.0):
triggers:
- gitlab-merge-request:
cron: '* * * * *'
project-path: 'test/project'
target-branch-regex: '(.*release.*|.*hotfix.*)'
use-http-url: false
assignee-filter: 'jenkinsbot'
tag-filter: 'fix'
trigger-comment: 'rebuild'
auto-close-failed: false
auto-merge-passed: false
Requires the Jenkins Gogs Plugin.
Example:
triggers: - gogs
Requires the Jenkins ScriptTrigger Plugin.
Full Example:
triggers:
- groovy-script:
script: groovy-content
script-file-path: path/to/filename
property-file-path: /path/to/properties/file
cron: H/15 * * * *
enable-concurrent: true
label: master
system-script: true
Minimal Example:
triggers: - groovy-script
Requires the Jenkins IvyTrigger Plugin.
Example:
triggers:
- ivy:
path: path/to/file
settings-path: path/to/settings/file
properties-file:
- 'filename1'
- 'filename2'
debug: true
cron: 'H/15 * * * *'
enable-concurrent: False
label: master
Requires the Jenkins JIRA Trigger Plugin.
Minimal Example:
triggers: - jira-changelog
Full Example:
triggers:
- jira-changelog:
jql-filter: filter
changelog-matchers:
- field-type: 'CUSTOM'
field: name
new-value: val1
old-value: val2
compare-new-value: true
compare-old-value: true
- field-type: 'JIRA'
field: versions
new-value: val3
old-value: val4
compare-new-value: true
compare-old-value: true
parameter-mapping:
- jenkins-parameter: param
issue-attribute-path: path
Requires the Jenkins JIRA Trigger Plugin.
Minimal Example:
triggers: - jira-comment-trigger
Full Example:
triggers:
- jira-comment-trigger:
jql-filter: filter
comment-pattern: comment
parameter-mapping:
- jenkins-parameter: param1
issue-attribute-path: 'path/to/attribute'
Requires the Jenkins JMS Messaging Plugin.
Full Example:
triggers:
- jms-messaging:
no-squash: True
selector: topic = "org.fedoraproject.prod.fedimg.image.upload"
provider-name: fedmsg
checks:
- field: compose
expected-value: .+compose_id.+Fedora-Atomic.+
- field: image_name
expected-value: .+Fedora-Atomic.+
Minimal Example:
triggers:
- jms-messaging:
selector: topic = "org.fedoraproject.prod.fedimg.image.upload"
provider-name: fedmsg
List of files to monitor
Minimal Example:
triggers:
- monitor-files:
files:
- path: 'path1'
Full Example:
triggers:
- monitor-files:
cron: '* * * * *'
files:
- path: 'path1'
strategy: 'IGNORE'
- path: 'path2'
check-content:
- simple: true
- jar: true
- tar: true
- zip: true
- source-manifest:
- all-keys: false
keys:
- key1
- key2
- jar-manifest:
- keys:
- key1
- key2
- properties:
- all-keys: false
keys:
- prop1
- prop2
- xml:
- 'xpath1'
- 'xpath2'
- text:
- 'regex1'
ignore-modificaton-date: false
Requires the Jenkins Filesystem Trigger Plugin.
Full Example:
triggers:
- monitor-folders:
path: 'pathname'
includes:
- 'pattern1'
- 'pattern2'
excludes: 'pattern1'
check-modification-date: false
check-content: false
check-fewer: false
cron: H/15 * * * *
Minimal Example:
triggers: - monitor-folders
Example:
triggers:
- parameterized-timer:
cron: "@midnight % PARAM=value"
Deprecated since version 1.3.0.: Please use cron.
Example:
triggers:
- pollscm:
cron: "*/30 * * * *"
ignore-post-commit-hooks: True
List of URLs to monitor
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+'
Requires the Jenkins RabbitMQ Build Trigger Plugin.
list of filters to apply (optional)
Example:
triggers:
- rabbitmq:
token: 'build_trigger_token'
Example with filters:
triggers:
- rabbitmq:
token: 'build_trigger_token'
filters:
- field: 'field1'
value: 'value1'
- field: 'field2'
value: 'value2'
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.
Example:
triggers:
- reverse:
jobs: 'Fantastic-job'
result: 'failure'
Example List:
triggers:
- reverse:
jobs:
- 'a'
- 'b'
- 'c'
result: 'failure'
Requires the Jenkins ScriptTrigger Plugin.
Full Example:
triggers:
- script:
script: 'exit 0'
script-file-path: '$WORKSPACE/scripts'
cron: 'H/15 * * * *'
enable-concurrent: true
label: master
exit-code: 0
Minimal Example:
triggers: - script
Requires the Jenkins Stash Pull Request Builder Plugin.
Minimal Example:
triggers:
- stash-pull-request:
cron: "* * * * *"
stash-host: "https://stash-host.com"
credentials-id: default-stash-credentials
project: stash-project
repository: stash-repo
Full Example:
triggers:
- stash-pull-request:
cron: "H 1 2 3 4"
stash-host: "https://stash-host.com"
credentials-id: default-stash-credentials
project: stash-project
repository: stash-repo
ci-skip-phrases: "test skip phrase"
ci-build-phrases: "test build phrase"
target-branches: "master"
ignore-ssl: true
check-destination-commit: true
check-mergable: true
merge-on-success: true
check-not-conflicted: false
only-build-on-comment: true
delete-previous-build-finish-comments: true
cancel-outdated-jobs: true
Example:
triggers: - timed: "@midnight"
Wrappers can alter the way the build is run as well as the build output.
Requires the Jenkins Android Emulator Plugin.
Example:
wrappers:
- android-emulator:
os: android-19
target-abi: x86
sd-card: 16MB
hardware-properties:
hw.accelerometer: 100
wipe: true
show-window: true
snapshot: true
delete: true
startup-delay: 10
commandline-options: "-gpu on -no-audio"
exe: emulator-arm
Requires the Jenkins Ansi Color Plugin.
Minimal Example:
wrappers: - ansicolor
Full Example:
wrappers:
- ansicolor:
colormap: "gnome-terminal"
Requires the Jenkins Artifactory Plugin
Example:
wrappers:
- artifactory-generic:
url: http://artifactory.example.net/artifactory
name: 'test'
deploy-build-info: true
repo-key: 'release-repo'
snapshot-repo-key: 'snapshot-repo'
deploy-pattern:
- '*.zip=>results'
resolve-pattern:
- 'libs-release-local:prod/*=>prod-jars'
matrix-params:
- 'custom_prop=${PROJECT_ENV_VAR}'
env-vars-include: true
env-vars-include-patterns:
- 'PROJECT_*'
- 'ORG_*'
discard-old-builds: true
discard-build-artifacts: true
Requires the Jenkins Artifactory Plugin
Example:
wrappers:
- artifactory-maven:
url: http://artifactory.example.net/artifactory
name: 'test'
repo-key: repo
Requires the Jenkins Artifactory Plugin
Example:
wrappers:
- artifactory-maven-freestyle:
url: http://artifactory.example.net/artifactory
name: 'test'
repo-key: repo
matrix-params:
- 'custom_prop=${PROJECT_ENV_VAR}'
deployment-include-patterns:
- '*.zip=>results'
env-vars-include: true
env-vars-include-patterns:
- 'PROJECT_*'
- 'ORG_*'
Requires the Jenkins Build Keeper Plugin.
Policy to keep builds.
Example:
wrappers:
- build-keeper:
policy: 'by-day'
build-period: 10
dont-keep-failed: true
wrappers:
- build-keeper:
policy: 'keep-first-failed'
number-of-fails: 1
Requires the Jenkins Build Name Setter Plugin.
Example:
wrappers:
- build-name:
name: Build-${FOO}
description: lorem ipsum dolor
run-at-start: true
run-at-end: false
Requires the Jenkins Build User Vars Plugin.
Example:
wrappers: - build-user-vars
Requires the Jenkins Ci Skip Plugin.
Example:
wrappers: - ci-skip
Requires the Jenkins Config File Provider Plugin.
List of managed config files made up of three parameters
Full Example:
wrappers:
- config-file-provider:
files:
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig5678
target: /foo.txt
variable: varName
replace-tokens: true
Minimal Example:
wrappers:
- config-file-provider:
files:
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234
Requires the Jenkins Copy To Slave Plugin.
Minimal Example:
wrappers:
- copy-to-slave
Full Example:
wrappers:
- copy-to-slave:
includes:
- 'file1'
- 'file2*.txt'
excludes:
- 'file2bad.txt'
flatten: True
relative-to: 'somewhereElse'
include-ant-excludes: True
Requires the Jenkins Credentials Binding Plugin version 1.1 or greater.
List of each bindings to create. Bindings may be of type zip-file, file, username-password, text, username-password-separated or amazon-web-services. username-password sets a variable to the username and password given in the credentials, separated by a colon. username-password-separated sets one variable to the username and one variable to the password given in the credentials. amazon-web-services sets one variable to the access key and one variable to the secret access key. Requires the AWS Credentials Plugin .
Example:
wrappers:
- credentials-binding:
- zip-file:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caa6
variable: CONFIG_ZIP
- file:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caab
variable: config_file
- username-password:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caac
variable: config_username_password
- text:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caad
variable: config_text
- docker-server-creds-binding:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caae
variable: config_docker_server
- credentials-binding:
- username-password-separated:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caag
username: myUsername
password: myPassword
- credentials-binding:
- amazon-web-services:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caaf
access-key: AWS_ACCESS_KEY_ID
secret-key: AWS_SECRET_ACCESS_KEY
- credentials-binding:
- ssh-user-private-key:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caah
key-file-variable: KEY_FILE_VARIABLE
username-variable: USER_NAME_VARIABLE
passphrase-variable: PASSPHRASE_VARIABLE
- credentials-binding:
- cert-multi-binding:
credential-id: b3e6f337-5d44-4f57-921c-1632d796caaj
keystore-variable: KEYSTORE_VARIABLE
password-variable: PASSWORD_VARIABLE
alias-variable: ALIAS_VARIABLE
Example:
wrappers:
- custom-tools:
tools:
- my_custom_tool
skip-master-install: true
convert-homes-to-upper: true
Requires the Jenkins Delivery Pipeline Plugin.
Minimal Example:
wrappers:
- delivery-pipeline
Full Example:
wrappers:
- delivery-pipeline:
version-template: 1.0.0-${BUILD_NUMBER}
set-display-name: true
Requires the Jenkins CloudBees Docker Custom Build Environment Plugin.
Volumes to bind mound from slave host into container
| Image Type | Description |
| dockerfile | Build docker image from a Dockerfile in project workspace. With this option, project can define the build environment as a Dockerfile stored in SCM with project source code 7.0 3.5 0.0 context-path (str) Path to docker context (default '.') dockerfile (str) Use an alternate Dockerfile to build the container hosting this build (default 'Dockerfile') 168u 168u 168u |
| pull | Pull specified docker image from Docker repository 7.0 3.5 0.0 image (str) Image id/tag 168u 168u 168u |
Example:
wrappers:
- docker-custom-build-env:
image-type: 'pull'
image: 'centos:7'
force-pull: true
privileged: true
verbose: true
group: jenkins
command: /bin/cat
net: bridge
memory-limit: memory=L<inf, memory-swap=inf
cpu-shares: 2
Requires the Jenkins Environment File Plugin.
Example:
wrappers:
- env-file:
properties-file: ${WORKSPACE}/foo
Requires the Jenkins Environment Script Plugin.
The script type.
Example:
wrappers:
- env-script:
script-content: 'echo foo=bar'
only-run-on-parent: true
Requires the Jenkins Exclusion Plugin.
Example:
wrappers:
- exclusion:
resources:
- myresource1
- myresource2
Requires the Jenkins GitHub Pull Request Builder Plugin.
List of custom statuses on the commit for when a build is completed
Minimal Example:
wrappers: - github-pull-request
Full Example:
wrappers:
- github-pull-request:
show-matrix-status: true
status-context: "my-build"
triggered-status: "build was triggered"
started-status: "build was started"
status-url: "http://1.2.3.4"
status-add-test-results: true
statuses:
- message: "build has succeeded"
result: SUCCESS
- message: "build has failed"
result: ERROR
Requires the Jenkins EnvInject Plugin.
Minimal Example:
wrappers:
- inject
Full Example:
wrappers:
- inject:
properties-file: example.prop full
properties-content: EXAMPLE=foo-bar full
script-file: scriptfull.sh
script-content: test script content full
groovy-script: test groovy-script location full
groovy-sandbox: true
Requires the Jenkins EnvInject Plugin and Jenkins Ownership plugin.
Example:
wrappers:
- inject-ownership-variables:
job-variables: true
node-variables: true
Requires the Jenkins EnvInject Plugin.
key value pair of job passwords
Example:
wrappers:
- inject-passwords:
global: true
mask-password-params: true
job-passwords:
- name: ADMIN
password: 0v8ZCNaHwq1hcx+sHwRLdg9424uBh4Pin0zO4sBIb+U=
Requires the Jenkins JClouds Plugin.
Example:
wrappers:
- jclouds:
single-use: True
instances:
- jenkins-dev-slave:
cloud-name: mycloud1
count: 1
stop-on-terminate: True
- jenkins-test-slave:
cloud-name: mycloud2
count: 2
stop-on-terminate: False
Requires the Jenkins Job Log Logger plugin.
Example:
wrappers:
- job-log-logger:
suppress-empty: false
Requires the Jenkins Live-Screenshot Plugin.
File type must be .png and they must be located inside the $WORKDIR.
Full Example:
wrappers:
- live-screenshot:
full-size: my_screenshot.png
thumbnail: my_screenshot-thumb.png
Minimal Example:
wrappers:
- live-screenshot
Requires the Jenkins Locks and Latches Plugin.
Example:
wrappers:
- locks:
- FOO
- FOO2
Requires the Jenkins Logfilesizechecker Plugin.
Full Example:
wrappers:
- logfilesize:
set-own: true
size: 1024
fail: true
Minimal Example:
wrappers: - logfilesize
Requires the Jenkins logstash plugin.
Redis config params
Example:
wrappers:
- logstash:
use-redis: True
redis:
host: 'localhost'
port: 6379
database-number: 0
database-password: 'password'
data-type: 'list'
key: 'logstash'
Requires the Jenkins M2 Repository Cleanup.
This plugin allows you to configure a maven2 job to clean some or all of the artifacts from the repository before it runs.
Example:
wrappers:
- m2-repository-cleanup:
patterns:
- com/ibm/**
- com/microsoft/**
Requires the Jenkins Mask Passwords Plugin.
Example:
wrappers: - mask-passwords
Requires the Jenkins Matrix Tie Parent Plugin.
Note that from Jenkins version 1.532 this plugin's functionality is available under the "advanced" option of the matrix project configuration. You can use the top level node parameter to control where the parent job is tied in Jenkins 1.532 and higher.
Example:
project-type: matrix
wrappers:
- matrix-tie-parent:
node: Unix
Requires the Jenkins M2 Release Plugin
Example:
wrappers:
- maven-release:
release-goals: -Dresume=false release:prepare release:perform
dry-run-goals: -Dresume=false -DdryRun=true release:prepare
num-successful-builds: 1
select-custom-scm-comment-prefix: false
select-append-jenkins-username: false
select-scm-credentials: false
release-env-var: IS_M2RELEASEBUILD
scm-user-env-var: SCM_USER
Requires the Jenkins MongoDB plugin.
Full Example:
wrappers:
- mongo-db:
name: 2.4.6
data-directory: /var/tmp/mongo
port: 5555
startup-params: "--bind_ip 127.0.0.1"
start-timeout: 5000
Minimal Example:
wrappers:
- mongo-db:
name: 2.4.6
Requires the Jenkins NodeJS Plugin.
Example:
wrappers:
- nodejs-installator:
name: "latest node"
Requires the Jenkins Openstack Cloud Plugin.
List of instances to be launched at the beginning of the build.
Example:
wrappers:
- openstack:
instances:
- cloud-name: mycloud1
template-name: jenkins-dev-slave
count: 1
- cloud-name: mycloud2
template-name: jenkins-test-slave
manual-template: True
count: 2
single-use: True
Requires the Jenkins Pathignore Plugin.
Example:
wrappers:
- pathignore:
ignored: "docs, tests"
Requires the Jenkins Port Allocator Plugin.
Example:
wrappers:
- port-allocator:
names:
- SERVER_PORT
- SERVER_PORT2
Requires the Jenkins Pre SCM BuildStep.
List of build steps to execute
Example:
wrappers:
- pre-scm-buildstep:
failOnError: true
buildsteps:
- shell: |
#!/bin/bash
echo "Doing something cool"
- shell: |
#!/bin/zsh
echo "Doing something cool with zsh"
- ant: "target1 target2"
ant-name: "Standard Ant"
- inject:
properties-file: example.prop
properties-content: EXAMPLE=foo-bar
Requires the Jenkins rbenv plugin.
All parameters are optional.
Example:
wrappers:
- rbenv:
ruby-version: 2.0.0-p353
ignore-local-version: false
preinstall-gem-list: "bundler,rake"
rbenv-root: "$HOME/.rbenv"
rbenv-repo: "https://github.com/sstephenson/rbenv.git"
rbenv-branch: "master"
ruby-build-repo: "https://github.com/sstephenson/ruby-build.git"
ruby-build-branch: "master"
Requires the Jenkins Release Plugin.
Example:
wrappers:
- release:
keep-forever: false
parameters:
- string:
name: RELEASE_BRANCH
default: ''
description: Git branch to release from.
- bool:
name: FOO
default: false
description: "A parameter named FOO, defaults to 'false'."
post-success:
- shell: |
#!/bin/bash
copy_build_artefacts.sh
Requires the Jenkins Rvm Plugin.
Example:
wrappers:
- rvm-env:
implementation: 1.9.3
Requires the Jenkins Sauce OnDemand Plugin.
Type of test to run (default selenium)
Example:
wrappers:
- sauce-ondemand:
enable-sauce-connect: true
sauce-host: foo
sauce-port: 8080
override-username: foo
override-api-access-key: 123lkj123kh123l;k12323
type: webdriver
platforms:
- Linuxandroid4
- Linuxfirefox10
- Linuxfirefox11
launch-sauce-connect-on-slave: true
Requires SonarQube plugin
Minimal Example:
wrappers: - sonar
Full Example:
wrappers:
- sonar:
install-name: test-sonar-installation
Requires the Jenkins SSH-Agent Plugin.
Example:
wrappers:
- ssh-agent-credentials:
users:
- '44747833-247a-407a-a98f-a5a2d785111c'
- 'f1c0f777-7ac6-43fd-b5c7-68b420aa1392'
- 'dd647a01-be21-402b-bfc5-a4e89be7d0c4'
Example:
wrappers:
- ssh-agent-credentials:
user: '49d20745-9889-4c02-b286-fc6fb89c36bd'
users:
- '44747833-247a-407a-a98f-a5a2d785111c'
- 'dd647a01-be21-402b-bfc5-a4e89be7d0c4'
The users with one value in list equals to the user. In this case old style XML will be generated. Use this format if you use SSH-Agent plugin < 1.5.
Example:
wrappers:
- ssh-agent-credentials:
users:
- '49d20745-9889-4c02-b286-fc6fb89c36bd'
equals to:
wrappers:
- ssh-agent-credentials:
user: '49d20745-9889-4c02-b286-fc6fb89c36bd'
Requires the Jenkins Build Timeout Plugin.
Example (Version < 1.14):
wrappers:
- timeout:
timeout: 90
timeout-var: 'BUILD_TIMEOUT'
fail: true
type: absolute
wrappers:
- timeout:
fail: false
type: likely-stuck
wrappers:
- timeout:
timeout-var: 'BUILD_TIMEOUT'
fail: true
elastic-percentage: 150
elastic-default-timeout: 90
type: elastic
Example (Version >= 1.14):
wrappers:
- timeout:
timeout: 90
timeout-var: 'BUILD_TIMEOUT'
fail: true
type: absolute
wrappers:
- timeout:
timeout: 5
timeout-var: 'BUILD_TIMEOUT'
type: no-activity
abort: true
write-description: "Blah Blah Blah"
wrappers:
- timeout:
timeout: 90
timeout-var: 'BUILD_TIMEOUT'
abort: true
type: likely-stuck
wrappers:
- timeout:
elastic-percentage: 150
elastic-default-timeout: 3
elastic-number-builds: 14
timeout-var: 'BUILD_TIMEOUT'
abort: true
type: elastic
wrappers:
- timeout:
deadline-time: '0:00:00'
deadline-tolerance: 1
timeout-var: 'BUILD_TIMEOUT'
type: deadline
Requires the Jenkins Timestamper Plugin.
Example:
wrappers: - timestamps
Secrets are generally masked in the build log.
Requires the Jenkins HashiCorp Vault Plugin.
List of secrets
Minimal Example:
wrappers:
- vault-secrets:
vault-url: 'http://127.0.0.1:8200'
credentials-id: 'myCredentials'
secrets:
- secret-path: 'secret/my-token'
secret-values:
- env-var: 'TOKEN'
vault-key: 'token'
Full Example:
wrappers:
- vault-secrets:
vault-url: 'http://127.0.0.1:8200'
credentials-id: 'myCredentials'
fail-if-not-found: 'false'
skip-ssl-verification: 'true'
engine-version: '2'
secrets:
- secret-path: 'secret/my-secret'
secret-values:
- env-var: 'USERNAME'
vault-key: 'username'
- env-var: 'PASSWORD'
vault-key: 'password'
- secret-path: 'secret/my-secret2'
engine-version: '2'
secret-values:
- env-var: 'USERNAME2'
vault-key: 'username2'
- env-var: 'PASSWORD2'
vault-key: 'password2'
Requires the Jenkins Version number plugin.
Example:
wrappers:
- version-number:
variable-name: relVersion
prefix-variable: relVersion
format-string: ${BUILD_DATE_FORMATTED, "yy.M"}.${BUILDS_THIS_MONTH_Z}
The post-build workspace-cleanup is available as a publisher.
Full Example:
wrappers:
- workspace-cleanup:
include:
- "_generated.py"
exclude:
- "*.py"
dirmatch: true
check-parameter: "DO_WS_CLEANUP"
external-deletion-command: "shred -u %s"
disable-deferred-wipeout: true
Minimal Example:
wrappers: - workspace-cleanup
Requires the Jenkins Xvfb Plugin.
Full Example:
wrappers:
- xvfb:
installation-name: default
auto-display-name: false
display-name: 123
assigned-labels: nodes-xxx
parallel-build: false
timeout: 10
screen: 1024x768x16
display-name-offset: 100
additional-options: -fbdir /tmp
debug: true
shutdown-with-build: false
Minimal Example:
wrappers: - xvfb
Requires the Jenkins xvnc plugin.
Full Example:
wrappers:
- xvnc:
screenshot: true
xauthority: false
Minimal Example:
wrappers: - xvnc
The Zuul module adds jobs parameters to manually run a build as Zuul would have. It is entirely optional, Zuul 2.0+ pass the parameters over Gearman.
Adds parameters describing the change triggering the build such as the branch name, change number and patchset.
See parameters expected by Zuul.
Example:
triggers: - zuul
Adds parameters describing the reference update triggering the build, which are the previous and next revisions in full (40 hexadecimal sha1) and short form.
See parameters expected by Zuul.
Example:
triggers: - zuul-post
The jenkins job builder modules are executed in sequence.
Jenkins Job Builder is quite modular. It is easy to add new attributes to existing components, a new module to support a Jenkins plugin, or include locally defined methods to deal with an idiosyncratic build system.
The Builder class manages Jenkins jobs. It's responsible for creating/deleting/updating jobs and can be called from your application. You can pass it a filename or an open file-like object that represents your YAML configuration. See the jenkins_jobs/builder.py file for more details.
Most of the work of building XML from the YAML configuration file is handled by individual functions that implement a single characteristic. For example, see the jenkins_jobs/modules/builders.py file for the Python module that implements the standard Jenkins builders. The shell function at the top of the file implements the standard Execute a shell build step. All of the YAML to XML functions in Jenkins Job Builder have the same signature:
The function is expected to examine the YAML data structure and create new XML nodes and attach them to the xml_parent element. This general pattern is applied throughout the included modules.
Nearly all of Jenkins Job Builder is implemented in modules. The main program has no concept of builders, publishers, properties, or any other aspects of job definition. Each of those building blocks is defined in a module, and due to the use of setuptools entry points, most modules are easily extensible with new components.
To add a new module, define a class that inherits from jenkins_jobs.modules.base.Base, and add it to the jenkins_jobs.modules entry point in your setup.py.
The module is initialized before any YAML is parsed.
Most of the standard modules supply a number of components, and it's easy to provide your own components for use by those modules. For instance, the Builders module provides several builders, such as the shell builder as well as the trigger_builds builder. If you wanted to add a new builder, all you need to do is write a function that conforms to the Component Interface, and then add that function to the appropriate entry point (via a setup.py file).
All modules and their associated components are registered in the module registry. It can be accessed either from modules via the registry field, or via the parser parameter of components.
See jenkins_jobs.modules.base.Base for how to register components of a module.
See the Publishers module for a simple example of how to use this method.
The return value is a dictionary with data obtained directly from a running Jenkins instance. This allows module authors to differentiate generated XML output based on information such as specific plugin versions.
During a 'test' run, it is possible to override JJB's query to a live Jenkins instance by passing it a path to a file containing a YAML list of dictionaries that mimics the plugin properties you want your test output to reflect:
jenkins-jobs test -p /path/to/plugins-info.yaml
Below is example YAML that might be included in /path/to/plugins-info.yaml.
- longName: 'Jenkins HipChat Plugin' shortName: 'hipchat' version: "0.1.8"
Jenkins Job Builder Maintainers
2023, Jenkins Job Builder Maintainers
| March 31, 2023 | 3.11.0 |