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.
Macro: | builder |
---|---|
Entry Point: | jenkins_jobs.builders |
Example:
job:
name: test_job
builders:
- shell: "make test"
Execute an ant target. Requires the Jenkins Ant Plugin.
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.
Parameter : | space separated list of Ant targets |
---|---|
Parameters: | ant-name (str) – the name of the ant installation, defaults to ‘default’ (optional) |
Example to call two Ant targets:
builders:
- ant: "target1 target2"
ant-name: "Standard Ant"
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:
Parameters: |
|
---|
Example specifying the build file too and several targets:
builders:
- ant:
targets: "debug test install"
buildfile: "build.xml"
properties:
builddir: "/tmp/"
failonerror: true
ant-name: "Standard Ant"
Allows one to resolve artifacts from a maven repository like nexus (without having maven installed) Requires the Jenkins Repository Connector Plugin
Parameters: |
|
---|
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
Execute a batch command.
Parameter : | the batch command to execute |
---|
Example:
builders:
- batch: "foo/foo.bat"
Use builders from another project. Requires the Jenkins Template Project Plugin.
Parameters: | projectName (str) – the name of the other project |
---|
Example:
builders:
- builders-from:
- project: "base-build"
Copy artifact from another project. Requires the Jenkins Copy Artifact plugin.
Parameters: |
|
---|
Example:
builders:
- copyartifact:
project: foo
filter: *.tar.gz
Execute gradle tasks. Requires the Jenkins ‘Gradle Plugin. <https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin>`_
Parameters: |
|
---|
Example:
builders:
- gradle:
wrapper: true
executable: true
tasks: |
init
build
tests
Inject an environment for the job. Requires the Jenkins EnvInject Plugin.
Parameters: |
|
---|
Example:
builders:
- inject:
properties-file: example.prop
properties-content: EXAMPLE=foo-bar
Execute a shell command.
Parameter : | the shell command to execute |
---|
Example:
builders:
- shell: "make test"
Trigger builds of other jobs. Requires the Jenkins Parameterized Trigger Plugin.
Parameters: |
|
---|
Example:
builders:
- trigger-builds:
- project: "build_started"
predefined-parameters:
FOO="bar"
block: true