Merge "AIAP Gate - Update script to use status-checker"

This commit is contained in:
Zuul 2021-11-11 19:51:57 +00:00 committed by Gerrit Code Review
commit cb7db9581b
1 changed files with 15 additions and 0 deletions

View File

@ -21,10 +21,14 @@ set -ex
INTERVAL=15
# Number of statuses that the status checker is looking at
STATUS_CHECKER_NUM=3
READY=false
KUBE_READY=false
# Wait for the Kubernetes environment to become completely ready
while [[ $KUBE_READY == "false" ]];
do
@ -62,3 +66,14 @@ do
sleep "$INTERVAL"
done
# Now that all of the containers are ready, keep an eye on the status-checker
# container until it shows that every status succeeds, and exit on any failure
while [[ $(kubectl logs airship-in-a-pod -c status-checker --tail 1 | grep -o "SUCCESS" | wc -l) -lt ${STATUS_CHECKER_NUM} ]]
do
# If any status is listed as "FAILED" then we should kill the script with a non 0 exit code
if [[ $(kubectl logs airship-in-a-pod -c status-checker --tail 1 | grep -c -o "FAILED") -gt 0 ]]; then
kubectl logs airship-in-a-pod -c status-checker --tail 1
exit 3
fi
sleep "$INTERVAL"
done