From 64ff73b7224a791e9c10d3700187ecbf0c1867d3 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Wed, 4 Sep 2024 15:45:24 +0200 Subject: [PATCH] gocd: slfo-stagings: Avoid busy waiting for 50 minutes, instead rely on scheduling from GoCD. --- gocd/slfo-stagings.gocd.yaml | 11 ++++++++--- gocd/slfo-stagings.gocd.yaml.erb | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gocd/slfo-stagings.gocd.yaml b/gocd/slfo-stagings.gocd.yaml index b4cfdc837..bb8fece8e 100644 --- a/gocd/slfo-stagings.gocd.yaml +++ b/gocd/slfo-stagings.gocd.yaml @@ -24,11 +24,16 @@ pipelines: - staging-bot tasks: - script: |- + set -eu export PYTHONPATH=$PWD/scripts cd scripts/gocd - while osc -A $STAGING_API api /build/$SLFO_RING_1_PROJECT/standard/x86_64?view=status | grep 'code=' | sed -E 's/^.*code="(.*)".*$/\1/' | grep -q finished; ret=$?; [ ${ret} -ne 0 ]; do - sleep 60 - done + status="$(osc -A $STAGING_API api /build/$SLFO_RING_1_PROJECT/standard/x86_64?view=status | grep 'code=' | sed -E 's/^.*code="(.*)".*$/\1/')" + echo $SLFO_RING_1_PROJECT status: "${status}" + if [ printf '%s' "${status}" | grep -q finished ]; then + exit 0 + else + exit 1 + fi - Freeze.stagings: ## 6 hours (at most 30 minutes per staging) timeout: 360 diff --git a/gocd/slfo-stagings.gocd.yaml.erb b/gocd/slfo-stagings.gocd.yaml.erb index a65beb225..b5c0f2845 100644 --- a/gocd/slfo-stagings.gocd.yaml.erb +++ b/gocd/slfo-stagings.gocd.yaml.erb @@ -25,11 +25,16 @@ pipelines: - staging-bot tasks: - script: |- + set -eu export PYTHONPATH=$PWD/scripts cd scripts/gocd - while osc -A $STAGING_API api /build/$SLFO_RING_1_PROJECT/standard/x86_64?view=status | grep 'code=' | sed -E 's/^.*code="(.*)".*$/\1/' | grep -q finished; ret=$?; [ ${ret} -ne 0 ]; do - sleep 60 - done + status="$(osc -A $STAGING_API api /build/$SLFO_RING_1_PROJECT/standard/x86_64?view=status | grep 'code=' | sed -E 's/^.*code="(.*)".*$/\1/')" + echo $SLFO_RING_1_PROJECT status: "${status}" + if [ printf '%s' "${status}" | grep -q finished ]; then + exit 0 + else + exit 1 + fi - Freeze.stagings: ## 6 hours (at most 30 minutes per staging) timeout: 360