[gnome-build-meta/sthursfield/james/openqa-master] openqa: Detect errors from server



commit 9b4d349c3f847868025f53e02e3cbb19c02f0b29
Author: Sam Thursfield <sam afuera me uk>
Date:   Tue Aug 10 12:17:11 2021 +0200

    openqa: Detect errors from server
    
    The openqa-cli tool returns success (0) even when server returns an
    error. To ensure the job aborts on errors, use `jq -e` to return
    failure (1) if server response is not what we expect.

 openqa/utils/setup_worker.sh    | 3 +--
 openqa/utils/start_job.sh       | 3 +--
 openqa/utils/teardown_worker.sh | 1 -
 3 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/openqa/utils/setup_worker.sh b/openqa/utils/setup_worker.sh
index 9619ba35..751cd786 100755
--- a/openqa/utils/setup_worker.sh
+++ b/openqa/utils/setup_worker.sh
@@ -5,7 +5,6 @@
 # On success, write the machine ID returned by server to stdout.
 
 set -eu
-set -o pipefail
 
 # Unique identifier for this machine, so we can tell the server to schedule
 # tests here.
@@ -32,4 +31,4 @@ openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
   settings[QEMUVGA]=virtio \
   settings[UEFI]=1 \
   settings[UEFI_PFLASH_CODE]=/usr/share/qemu/ovmf-x86_64-code.bin \
-  settings[WORKER_CLASS]=$worker_class | tee --append openqa.log | jq .id > /tmp/machine_id
+  settings[WORKER_CLASS]=$worker_class | tee --append openqa.log | jq -e .id > /tmp/machine_id
diff --git a/openqa/utils/start_job.sh b/openqa/utils/start_job.sh
index 79f5937f..05c72293 100755
--- a/openqa/utils/start_job.sh
+++ b/openqa/utils/start_job.sh
@@ -5,7 +5,6 @@
 # On success, write the job ID returned by server to stdout.
 
 set -eu
-set -o pipefail
 
 worker_class=$1
 version=$2
@@ -20,4 +19,4 @@ openqa-cli api --apikey $OPENQA_API_KEY --apisecret $OPENQA_API_SECRET \
   ARCH=x86_64 \
   WORKER_CLASS=$worker_class \
   CASEDIR=$(pwd)/openqa \
-  NEEDLES_DIR=$OPENQA_NEEDLES_GIT#$OPENQA_NEEDLES_SHA | tee --append openqa.log | jq .ids[0]
+  NEEDLES_DIR=$OPENQA_NEEDLES_GIT#$OPENQA_NEEDLES_SHA | tee --append openqa.log | jq -e .ids[0]
diff --git a/openqa/utils/teardown_worker.sh b/openqa/utils/teardown_worker.sh
index 274555a8..93003323 100755
--- a/openqa/utils/teardown_worker.sh
+++ b/openqa/utils/teardown_worker.sh
@@ -3,7 +3,6 @@
 # Delete machine on $OPENQA_HOST.
 
 set -eu
-set -o pipefail
 
 machine_id=$1
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]