Wrappers

Wrappers can alter the way the build is run as well as the build output.

Component: wrappers
Macro:wrapper
Entry Point:jenkins_jobs.wrappers

Example:

job:
  name: test_job

  wrappers:
    - timeout:
        timeout: 90
        fail: true
ansicolor

Translate ANSI color codes to HTML in the console log. Requires the Jenkins Ansi Color Plugin.

Example:

wrappers:
  - ansicolor
build-name

Set the name of the build Requires the Jenkins Build Name Setter Plugin.

Parameters:name (str) – Name for the build. Typically you would use a variable from Jenkins in the name. The syntax would be ${FOO} for the FOO variable.

Example:

wrappers:
  - build-name:
      name: Build-${FOO}
copy-to-slave

Copy files to slave before build Requires the Jenkins Copy To Slave Plugin.

Parameters:
  • includes (list) – list of file patterns to copy
  • excludes (list) – list of file patterns to exclude
  • flatten (bool) – flatten directory structure
  • relative-to (str) – base location of includes/excludes, must be userContent ($JENKINS_HOME/userContent) home ($JENKINS_HOME) or workspace
  • include-ant-excludes (bool) – exclude ant’s default excludes

Example:

wrappers:
  - copy-to-slave:
      includes:
        - file1
        - file2*.txt
      excludes:
        - file2bad.txt
inject

Add or override environment variables to the whole build process Requires the Jenkins EnvInject Plugin.

Parameters:
  • properties-file-path (str) – path to the properties file (default ‘’)
  • properties-content (str) – key value pair of properties (default ‘’)
  • script-file-path (str) – path to the script file (default ‘’)
  • script-content (str) – contents of a script (default ‘’)

Example:

wrappers:
  - inject:
      properties-file-path: /usr/local/foo
      properties-content: PATH=/foo/bar
      script-file-path: /usr/local/foo.sh
      script-content: echo $PATH
jclouds
Parameters:
  • single-use (bool) – Whether or not to terminate the slave after use (default: False).
  • instances (list) – The name of the jclouds template to create an instance from, and its parameters.
  • cloud-name (str) – The name of the jclouds profile containing the specified template.
  • count (int) – How many instances to create (default: 1).
  • stop-on-terminate (bool) – Whether or not to suspend instead of terminate the instance (default: False).

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
locks

Control parallel execution of jobs. Requires the Jenkins Locks and Latches Plugin.

Arg :list of locks to use

Example:

wrappers:
  - locks:
      - FOO
      - FOO2
mask-passwords

Hide passwords in the console log. Requires the Jenkins Mask Passwords Plugin.

Example:

wrappers:
  - mask-passwords
port-allocator

Assign unique TCP port numbers Requires the Jenkins Port Allocator Plugin.

Parameters:name (str) – Variable name of the port or a specific port number

Example:

wrappers:
  - port-allocator:
      name: SERVER_PORT
timeout

Abort the build if it runs too long. Requires the Jenkins Build Timeout Plugin.

Parameters:
  • timeout (int) – Abort the build after this number of minutes
  • fail (bool) – Mark the build as failed (default false)

Example:

wrappers:
  - timeout:
      timeout: 90
      fail: true
timestamps

Add timestamps to the console log. Requires the Jenkins Timestamper Plugin.

Example:

wrappers:
  - timestamps
workspace-cleanup

See Workspace Cleanup Plugin.

Parameters:
  • include (list) – list of files to be included
  • exclude (list) – list of files to be excluded
  • dirmatch (bool) – Apply pattern to directories too

Example:

wrappers:
  - workspace-cleanup:
      include:
        - "*.zip"

Previous topic

Triggers

Next topic

Zuul

This Page