diff options
author | Matt Rendina <mrendina@stsci.edu> | 2017-12-05 17:56:25 -0500 |
---|---|---|
committer | Matt Rendina <mrendina@stsci.edu> | 2017-12-05 17:56:25 -0500 |
commit | ed6234375a09a45eaed6d2c3f3cc947cd7fd5086 (patch) | |
tree | 6e083393465944cada81e94f62ee942173e7097e /vars/utils.groovy | |
parent | 5ad889bebac2e9d4044ad39e7c99ac870f305cdf (diff) | |
download | jscu_refactor-ed6234375a09a45eaed6d2c3f3cc947cd7fd5086.tar.gz |
Skip test report ingest if .xml file does not exist.
Diffstat (limited to 'vars/utils.groovy')
-rw-r--r-- | vars/utils.groovy | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/vars/utils.groovy b/vars/utils.groovy index 25f52c7..8f4fadf 100644 --- a/vars/utils.groovy +++ b/vars/utils.groovy @@ -72,13 +72,22 @@ def concurrent(configs) { } finally { // TODO: Test for presence of report file. - step([$class: 'XUnitBuilder', - thresholds: [ - [$class: 'SkippedThreshold', unstableThreshold: "${myconfig.skippedUnstableThresh}"], - [$class: 'SkippedThreshold', failureThreshold: "${myconfig.skippedFailureThresh}"], - [$class: 'FailedThreshold', unstableThreshold: "${myconfig.failedUnstableThresh}"], - [$class: 'FailedThreshold', failureThreshold: "${myconfig.failedFailureThresh}"]], - tools: [[$class: 'JUnitType', pattern: '*.xml']]]) + // This will throw an error if a non JUnit format .xml file exists in the + // root of the workspace. Specifying an explicit test report file name + // would avoid this, but that value must be passed in from the Jenkinsfile + // somehow or a standard name used. + report_exists = sh(script: "test -e *.xml", returnStatus: true) + if (report_exists == 0) { + step([$class: 'XUnitBuilder', + thresholds: [ + [$class: 'SkippedThreshold', unstableThreshold: "${myconfig.skippedUnstableThresh}"], + [$class: 'SkippedThreshold', failureThreshold: "${myconfig.skippedFailureThresh}"], + [$class: 'FailedThreshold', unstableThreshold: "${myconfig.failedUnstableThresh}"], + [$class: 'FailedThreshold', failureThreshold: "${myconfig.failedFailureThresh}"]], + tools: [[$class: 'JUnitType', pattern: '*.xml']]]) + } else { + println("No .xml files found in workspace. Test report ingest skipped.") + } } } } // end withEnv |