Created
June 5, 2019 09:42
-
-
Save tdshipley/9210161320501568a82737fce78dc39f to your computer and use it in GitHub Desktop.
Script to wait for a test to finish running in a K8s Pod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
passed="false" | |
failed="false" | |
while [ "$failed" == "false" ] && [ "$passed" == "false" ] && [ $tryCount -lt $maxWaitTime ] | |
do | |
tryCount=$((tryCount + 1)) | |
podLogs=$(kubectl logs --tail=80 pods/$runningPod) | |
case $podLogs in | |
*"Test run passed"*) passed="true";; | |
*"Test run failed"*) failed="true";; | |
*) sleep 5 | |
esac | |
timeWaited=$((tryCount * 5)) | |
echo "Waiting for test run to finish. Waited: $timeWaited seconds" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment