Fix: Ignore unbounded variable BUILD_RESULT 13/70413/3 v0.79.1
authorAnil Belur <abelur@linuxfoundation.org>
Tue, 26 Jul 2022 21:20:50 +0000 (07:20 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Tue, 26 Jul 2022 22:16:40 +0000 (08:16 +1000)
Error: BUILD_RESULT: unbound variable

Change-Id: Iefbf3d6f658632990529015f35336cadb65e379c
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
shell/job-cost.sh

index e5e1810..85096cd 100644 (file)
@@ -76,7 +76,7 @@ else
 fi
 
 # Archive the cost date
-mkdir -p "$WORKSPACE/archives/cost"
+mkdir -p "${WORKSPACE}/archives/cost"
 
 echo "INFO: Archiving Costs"
 
@@ -85,5 +85,5 @@ echo "INFO: Archiving Costs"
 date=$(TZ=GMT date +'%Y-%m-%d %H:%M:%S')
 
 # Format the uptime, cost & stack_cost fields
-printf "%s,%s,%s,%s,%d,%.2f,%.2f,%s\n" "$JOB_NAME" "$BUILD_NUMBER" "$date" \
-       "$resource" "$uptime" "$cost" "$stack_cost" "$BUILD_RESULT" > "$WORKSPACE/archives/cost.csv"
+printf "%s,%s,%s,%s,%d,%.2f,%.2f,%s\n" "${JOB_NAME:-}" "${BUILD_NUMBER:-}" "$date" \
+       "$resource" "$uptime" "$cost" "$stack_cost" "${BUILD_RESULT:-}" > "${WORKSPACE}/archives/cost.csv"