Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created May 31, 2021 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KyMidd/a9ee3a2e66ef223a85d758b8122a2d24 to your computer and use it in GitHub Desktop.
Save KyMidd/a9ee3a2e66ef223a85d758b8122a2d24 to your computer and use it in GitHub Desktop.
while [ 0=0 ]; do
echo "##[command]Checking Job status"
if [ $job1_still_checking = "yes" ]; then
job1_results=$(aws batch describe-jobs --jobs $job1 --region us-east-1 | jq -r '.jobs[].status')
echo $job1_name "has status:" $job1_results
case $job1_results in
"SUCCEEDED")
echo "##[section]"$job1_name "job succeeded"
job1_still_checking="no"
;;
"FAILED")
echo "##[error]"$job1_name "job failed"
job1_still_checking="no"
break
;;
esac
fi
if [ $job2_still_checking = "yes" ]; then
job2_results=$(aws batch describe-jobs --jobs $job2 --region us-east-1 | jq -r '.jobs[].status')
echo $job2_name "has status:" $job2_results
case $job2_results in
"SUCCEEDED")
echo "##[section]"$job2_name "job succeeded"
job2_still_checking="no"
;;
"FAILED")
echo "##[error]"$job2_name "job failed"
job2_still_checking="no"
break
;;
esac
fi
# If any jobs still waiting, loop
if [ $job1_still_checking = "no" -a $job2_still_checking = "no" ]; then
echo "##[section]Done checking"
break
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment