From aea332029a462ff15a0a52463f7b2e5ea6447e51 Mon Sep 17 00:00:00 2001 From: Daniel Pawlik Date: Thu, 1 Aug 2019 08:21:24 +0000 Subject: [PATCH] Fix infinity loop when all actions are already completed Wait-for-shipyard sctipt was just checking actions that are in "Processing" state, but if some actions are "Complete", it comes to infinity loop. Change-Id: I9c007a60227159af561f5ceacf5fc3dd469fce0c --- tools/gate/wait-for-shipyard.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/gate/wait-for-shipyard.sh b/tools/gate/wait-for-shipyard.sh index 44c2ba5cb..00af0b6e9 100755 --- a/tools/gate/wait-for-shipyard.sh +++ b/tools/gate/wait-for-shipyard.sh @@ -19,11 +19,18 @@ set -e REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )" : "${SHIPYARD:=${REPO_DIR}/tools/airship shipyard}" -ACTION=$(${SHIPYARD} get actions | grep -i "Processing" | awk '{ print $2 }') +ACTION=$(${SHIPYARD} get actions | tail -n +2 | grep "action\/" | grep -iE "Processing|Complete" | awk '{ print $2 }') echo -e "\nWaiting for $ACTION..." while true; do + # Check if there is just one action ongoing or completed. + # If yes, break the loop. + if [ "$(echo "${ACTION}" | wc -l)" -eq 1 ]; then + echo -e "\n$ACTION has been completed" + break + fi + # Print the status of tasks ${SHIPYARD} describe "${ACTION}"