Skip to content

Publish results

Sam Gleske edited this page Apr 11, 2018 · 11 revisions

Publishing the results of a build could be a number of different types of artifacts. The settings for collecting results are grouped under jenkins > collect in the YAML.

Currently, the existing supported results collected are:

  • artifacts - Binary artifacts.
  • cobertura - cobertura code coverage results.
  • html - publish an HTML report.
  • junit - Java unit test reports (or junit-compatible XML).

There is a short and long format for publishing results. The following is example YAML of short format for publishing results.

jenkins:
  collect:
    artifacts: 'file file pattern'
    junit: 'file pattern to JUnit XML'
    cobertura: 'path to coverage.xml'

Collect artifacts

Short form example:

jenkins:
  collect:
    artifacts: 'build/libs/*.jar'

The short form assumes defaults from the long form YAML. The following is the long form example including defaults for each value when the short form is used.

jenkins:
  collect:
    artifacts:
      path: 'build/libs/*.jar'
      excludes: ''
      allowEmptyArchive: false
      caseSensitive: true
      defaultExcludes: true

The options are documented in the Jenkins source code in the following places.

Collect JUnit reports

Short form example:

jenkins:
  collect:
    junit: 'build/test-results/*.xml'

Customize behavior using the long form. The following has defaults defined for the short form:

jenkins:
  collect:
    junit:
      path: 'build/test-results/*.xml'
      allowEmptyResults: false
      healthScaleFactor: 1.0
      keepLongStdio: false

The options are documented in the Jenkins source code in the following places.

Collect Cobertura coverage reports

Short form example:

jenkins:
  collect:
    cobertura: 'build/reports/cobertura/coverage.xml'

Customize behavior using the long form. The following has defaults defined for the short form:

jenkins:
  collect:
    cobertura:
      path: 'build/reports/cobertura/coverage.xml'
      autoUpdateHealth: false
      autoUpdateStability: false
      failNoReports: false
      failUnhealthy: false
      failUnstable: false
      maxNumberOfBuilds: 0
      onlyStable: false
      sourceEncoding: 'ASCII'
      zoomCoverageChart: false
      methodCoverageTargets: '80, 0, 0'
      lineCoverageTargets: '80, 0, 0'
      conditionalCoverageTargets: '70, 0, 0'

The options are documented in the Jenkins source code cobertura plugin.