From: Eric Ball Date: Tue, 22 Jun 2021 21:51:19 +0000 (-0700) Subject: Fix: job-cost.sh no longer causes build failures X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=958cd7e315bbc9ba310183e4d590ee91b14940ee;p=releng%2Fpipelines.git Fix: job-cost.sh no longer causes build failures job-cost.sh is gathering data, and if there is an error while doing this, it should not cause the build to fail. If an error is detected, it will be caught, a note is printing, and then the function will simply return. Issue: IT-22309 Signed-off-by: Eric Ball Change-Id: Ibba89d89223599e3ff9b077d036f5036d3252a68 --- diff --git a/vars/lfParallelCostCapture.groovy b/vars/lfParallelCostCapture.groovy index 9f60d84..dd1ae26 100644 --- a/vars/lfParallelCostCapture.groovy +++ b/vars/lfParallelCostCapture.groovy @@ -16,8 +16,14 @@ // limitations under the License. def call() { - sh(script: libraryResource('shell/job-cost.sh')) - cost_str = sh(script: "cat $WORKSPACE/archives/cost.csv | cut -d, -f6", returnStdout: true) + try { + sh(script: libraryResource('shell/job-cost.sh')) + cost_str = sh(script: "cat $WORKSPACE/archives/cost.csv | cut -d, -f6", returnStdout: true) + } catch(Exception e) { + // Failure in job-cost.sh should not affect the rest of the run. + println("Exception caught while running job-cost.sh.") + return + } lock("${BUILD_TAG}-stack-cost") { try {