From 613ed796a057c96251c341a6aa64851cadf7fa1e Mon Sep 17 00:00:00 2001 From: Danny Massa Date: Wed, 17 Feb 2021 15:29:46 -0600 Subject: [PATCH] feat(gate) adding retry mechanism to jarvis-projects verification Occasionally, the request made to Gerrit is made before the Verified label is applied by the pipeline. To remedy this we will send the request multiple times until the expected result is returned (or until it has been tried 6 times in 30 seconds) Change-Id: Ie876cf94e4a56684f25d868008a1b78054cac09b --- .../gate/jarvis/800-deploy-jarvis-projects.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/gate/jarvis/800-deploy-jarvis-projects.sh b/tools/gate/jarvis/800-deploy-jarvis-projects.sh index 22c9e995..a2f2fec8 100755 --- a/tools/gate/jarvis/800-deploy-jarvis-projects.sh +++ b/tools/gate/jarvis/800-deploy-jarvis-projects.sh @@ -69,9 +69,18 @@ EOF fi done - # Ensure that the patch set has been labelled `Verified` by the Jarvis System - VERIFIED="$(curl -L https://gerrit.jarvis.local/changes/${change_id}/revisions/1/review/ | tail -1 | jq -r .labels.Verified.all[0].value)" - if [ "$VERIFIED" -ne 1 ]; then - exit 1 - fi + # Check that Jarvis-System has reported the success of the pipeline run to Gerrit + end=$(date +%s) + timeout="30" + end=$((end + timeout)) + while true; do + VERIFIED="$(curl -L https://gerrit.jarvis.local/changes/${change_id}/revisions/1/review/ | tail -1 | jq -r .labels.Verified.all[0].value)" + [ "$VERIFIED" == 1 ] && break || true + sleep 5 + now=$(date +%s) + if [ "$now" -gt "$end" ] ; then + echo "Jarvis-System has not verified the change" + exit 1 + fi + done done \ No newline at end of file