Fix wait script to wait for Processing actions
The script must wait for Processing actions if they exist, it also needs to fail if it failed to retrieve a list of actions from Shipyard. Change-Id: I806a2c5c2e05fa768c6c3434c5c6d9bd102c6c92
This commit is contained in:
parent
390f98784a
commit
d5d5481422
@ -15,22 +15,21 @@
|
||||
# under the License
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )"
|
||||
: "${SHIPYARD:=${REPO_DIR}/tools/airship shipyard}"
|
||||
|
||||
ACTION=$(${SHIPYARD} get actions | tail -n +2 | grep "action\/" | grep -iE "Processing|Complete" | awk '{ print $2 }')
|
||||
ACTION=$(${SHIPYARD} get actions | grep -i "Processing" | awk '{ print $2 }')
|
||||
|
||||
# Exit earlier if there is nothing to wait for.
|
||||
if [ -z "${ACTION}" ]; then
|
||||
echo "No actions in Processing state, exiting..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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…
Reference in New Issue
Block a user