Created
June 19, 2019 09:40
-
-
Save lupupaulsv/f8ef077dfb24ad1103704b3ff089d777 to your computer and use it in GitHub Desktop.
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
for i in ${ids[@]} | |
do | |
echo "Waiting for build ID $i running on account: $ACCOUNT_ID" | |
echo "Debug information at https://us-west-2.console.aws.amazon.com/systems-manager/automation/execution/$i?region=$AWS_DEFAULT_REGION" | |
while true; | |
do | |
status=$(aws ssm get-automation-execution --output text --automation-execution-id "$i" ) | |
if [[ $(echo "$status" | grep -i "status" | grep -i "failed") ]]; then | |
### something has gone wrong, stop the execution | |
echo "Build failed!" | |
exit 1 | |
fi | |
if [[ $(echo "$status" | grep -i "imagestate" | grep -i "available") ]]; then | |
### store the new AMI since we'll need them in terraform | |
new_amis[$k]=$( echo "$status" |grep CREATEIMAGE.IMAGEID | grep -oP ami-[a-z0-9]+) | |
let k++ | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment