Publishers

Publishers define actions that the Jenkins job should perform after the build is complete.

Component: publishers
Macro:publisher
Entry Point:jenkins_jobs.publishers

Example:

job:
  name: test_job

  publishers:
    - scp:
        site: 'example.com'
        source: 'doc/build/html/**/*'
        target_path: 'project'
aggregate-tests

Aggregate downstream test results

Parameters:include-failed-builds (bool) – whether to include failed builds

Example:

publishers:
  - aggregate-tests:
      include-failed-builds: true
archive

Archive build artifacts

Parameters:
  • artifacts (str) – path specifier for artifacts to archive
  • excludes (str) – path specifier for artifacts to exclude
  • latest_only (bool) – only keep the artifacts from the latest successful build

Example:

publishers:
  - archive:
      artifacts: *.tar.gz
claim-build

Claim build failures Requires the Jenkins Claim Plugin.

Example:

publishers:
  - claim-build
copy-to-master

Copy files to master from slave Requires the Jenkins Copy To Slave Plugin.

Parameters:
  • includes (list) – list of file patterns to copy
  • excludes (list) – list of file patterns to exclude
  • destination (string) – absolute path into which the files will be copied. If left blank they will be copied into the workspace of the current job

Example:

publishers:
  - copy-to-master:
      includes:
        - file1
        - file2*.txt
      excludes:
        - file2bad.txt
coverage

Generate a cobertura coverage report. Requires the Jenkins Cobertura Coverage Plugin.

Example:

publishers:
  - coverage
cppcheck

Cppcheck result publisher Requires the Jenkins Cppcheck Plugin.

Parameters:pattern (str) – file pattern for cppcheck xml report

for more optional parameters see the example

Example:

publishers:
  - cppcheck:
      pattern: "**/cppcheck.xml"
      # the rest is optional
      # build status (new) error count thresholds
      thresholds:
        unstable: 5
        new-unstable: 5
        failure: 7
        new-failure: 3
        # severities which count towards the threshold, default all true
        severity:
          error: true
          warning: true
          information: false
      graph:
        xysize: [500, 200]
        # which errors to display, default only sum
        display:
          sum: false
          error: true
email

Email notifications on build failure.

Parameters:
  • recipients (str) – Recipient email addresses
  • notify-every-unstable-build (bool) – Send an email for every unstable build (default true)
  • send-to-individuals (bool) – Send an email to the individual who broke the build (default false)

Example:

publishers:
  - email:
      recipients: breakage@example.com
email-ext

Extend Jenkin’s built in email notification Requires the Jenkins Email-ext Plugin.

Parameters:
  • recipients (str) – Comma separated list of emails
  • subject (str) – Subject for the email, can include variables like ${BUILD_NUMBER} or even groovy or javascript code
  • body (str) – Content for the body of the email, can include variables like ${BUILD_NUMBER}, but the real magic is using groovy or javascript to hook into the Jenkins API itself
  • unstable (bool) – Send an email for an unstable result (default false)
  • first-failure (bool) – Send an email for just the first failure (default false)
  • not-built (bool) – Send an email if not built (default false)
  • aborted (bool) – Send an email if the build is aborted (default false)
  • regression (bool) – Send an email if there is a regression (default false)
  • failure (bool) – Send an email if the build fails (default true)
  • improvement (bool) – Send an email if the build improves (default false)
  • still-failing (bool) – Send an email if the build is still failing (default false)
  • success (bool) – Send an email for a successful build (default false)
  • fixed (bool) – Send an email if the build is fixed (default false)
  • still-unstable (bool) – Send an email if the build is still unstable (default false)
  • pre-build (bool) – Send an email before the build (default false)

Example:

publishers:
  - email-ext:
      recipients: foo@example.com, bar@example.com
      subject: Subject for Build ${BUILD_NUMBER}
      body: The build has finished
      unstable: true
      first-failure: true
      not-built: true
      aborted: true
      regression: true
      failure: true
      improvement: true
      still-failing: true
      success: true
      fixed: true
      still-unstable: true
      pre-build: true
fingerprint

Fingerprint files to track them across builds

Parameters:
  • files (str) – files to fingerprint, follows the @includes of Ant fileset (default is blank)
  • record-artifacts (bool) – fingerprint all archived artifacts (default false)

Example:

publishers:
  - fingerprint:
      files: builddir/test*.xml
      record-artifacts: false
ftp

Upload files via FTP. Requires the Jenkins Publish over FTP Plugin.

Parameters:
  • site (str) – name of the ftp site
  • target (str) – destination directory
  • source (str) – source path specifier
  • excludes (str) – excluded file pattern (optional)
  • remove-prefix (str) – prefix to remove from uploaded file paths (optional)

Example:

publishers:
  - ftp:
      site: 'ftp.example.com'
      target: 'dest/dir'
      source: 'base/source/dir/**'
      remove-prefix: 'base/source/dir'
      excludes: '**/*.excludedfiletype'
jira

Update relevant JIRA issues Requires the Jenkins JIRA Plugin

Example:

publishers:
  - jira
junit

Publish JUnit test results.

Parameters:results (str) – results filename

Example:

publishers:
  - junit:
      results: nosetests.xml
logparser

Requires the Jenkins Log Parser Plugin.

Parameters:
  • parse-rules (str) – full path to parse rules
  • unstable-on-warning (bool) – mark build unstable on warning
  • fail-on-error (bool) – mark build failed on error
Example::
publishers:
  • logparser:

    parse-rules: “/path/to/parserules” unstable-on-warning: true fail-on-error: true

pipeline

Specify a downstream project in a pipeline. Requires the Jenkins Build Pipeline Plugin.

Parameter :the name of the downstream project

Example:

publishers:
  - pipleline: deploy

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.

scp

Upload files via SCP Requires the Jenkins SCP Plugin.

Parameters:
  • site (str) – name of the scp site
  • target (str) – destination directory
  • source (str) – source path specifier
  • keep-hierarchy (bool) – keep the file hierarchy when uploading (default false)
  • copy-after-failure (bool) – copy files even if the job fails (default false)
  • copy-console (bool) – copy the console log (default false); if specified, omit ‘target’

Example:

publishers:
  - scp:
      site: 'example.com'
      target: 'dest/dir'
      source: 'base/source/dir/**'
trigger

Trigger non-parametrised builds of other jobs.

Parameters:
  • project (str) – name of the job to trigger
  • threshold (str) – when to trigger the other job (default ‘SUCCESS’), alternatives: SUCCESS, UNSTABLE, FAILURE

Example:

publishers:
  - trigger:
      project: other_job
trigger-parameterized-builds

Trigger parameterized builds of other jobs. Requires the Jenkins Parameterized Trigger Plugin.

Parameters:
  • project (str) – name of the job to trigger
  • predefined-parameters (str) – parameters to pass to the other job (optional)
  • condition (str) – when to trigger the other job (default ‘ALWAYS’)

Example:

publishers:
  - trigger-parameterized-builds:
      project: other_job
violations

Publish code style violations. Requires the Jenkins Violations Plugin.

The violations component accepts any number of dictionaries keyed by the name of the violations system. The dictionary has the following values:

Parameters:
  • min (int) – sunny threshold
  • max (int) – stormy threshold
  • unstable (int) – unstable threshold
  • pattern (str) – report filename pattern

Any system without a dictionary provided will use default values.

Valid systems are:

checkstyle, codenarc, cpd, cpplint, csslint, findbugs, fxcop, gendarme, jcreport, jslint, pep8, pmd, pylint, simian, stylecop

Example:

publishers:
  - violations:
      pep8:
        min: 0
        max: 1
        unstable: 1
        pattern: '**/pep8.txt'
xunit

Publish tests results. Requires the Jenkins xUnit Plugin.

Parameters:
  • thresholdmode (str) – whether thresholds represents an absolute number of tests or a percentage. Either ‘number’ or ‘percent’, will default to ‘number’ if omitted.
  • thresholds (dict) – list containing the thresholds for both ‘failed’ and ‘skipped’ tests. Each entry should in turn have a list of “threshold name: values”. The threshold names are ‘unstable’, ‘unstablenew’, ‘failure’, ‘failurenew’. Omitting a value will resort on xUnit default value (should be 0).
  • types (dict) – per framework configuration. The key should be one of the internal types we support: ‘aunit’, ‘boosttest’, ‘checktype’, ‘cpptest’, ‘cppunit’, ‘fpcunit’, ‘junit’, ‘mstest’, ‘nunit’, ‘phpunit’, ‘tusar’, ‘unittest’, ‘valgrind’. The ‘custom’ type is not supported.

Each framework type can be configured using the following parameters:

Parameters:
  • pattern (str) – An Ant pattern to look for Junit result files, relative to the workspace root.
  • requireupdate (bool) – fail the build whenever fresh tests results have not been found (default: true).
  • deleteoutput (bool) – delete temporary JUnit files (default: true)
  • stoponerror (bool) – Fail the build whenever an error occur during a result file processing (default: true).

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
          - cppUnit:
              pattern: cppunit.log

Previous topic

Properties

Next topic

Reporters

This Page