From 958cd7e315bbc9ba310183e4d590ee91b14940ee Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Tue, 22 Jun 2021 14:51:19 -0700 Subject: [PATCH] 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 --- vars/lfParallelCostCapture.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 { -- 2.16.6