Browse Source

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
changes/53/673953/2
Daniel Pawlik 2 years ago
committed by Drew Walters
parent
commit
aea332029a
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      tools/gate/wait-for-shipyard.sh

+ 8
- 1
tools/gate/wait-for-shipyard.sh View File

@ -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}"


Loading…
Cancel
Save