File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9595 --query 'Command.CommandId' \
9696 --output text)
9797
98+ echo "Waiting for SSM command ${COMMAND_ID} to complete..."
99+ for i in {1..60}; do
100+ STATUS=$(aws ssm get-command-invocation \
101+ --region "${AWS_REGION}" \
102+ --command-id "${COMMAND_ID}" \
103+ --instance-id "${EC2_INSTANCE_ID}" \
104+ --query 'Status' \
105+ --output text 2>/dev/null || echo "Pending")
106+
107+ case "${STATUS}" in
108+ Success)
109+ echo "SSM command succeeded"
110+ break
111+ ;;
112+ Failed|Cancelled|TimedOut)
113+ echo "SSM command failed with status: ${STATUS}"
114+ aws ssm get-command-invocation \
115+ --region "${AWS_REGION}" \
116+ --command-id "${COMMAND_ID}" \
117+ --instance-id "${EC2_INSTANCE_ID}" \
118+ --query 'StandardErrorContent' \
119+ --output text
120+ exit 1
121+ ;;
122+ *)
123+ echo "Status: ${STATUS} (attempt $i/60)"
124+ sleep 5
125+ ;;
126+ esac
127+ done
128+
98129 - name : Verify health
99130 run : |
100131 set -euo pipefail
@@ -119,4 +150,5 @@ jobs:
119150 sleep 3
120151 done
121152
122- echo "Health check failed"
153+ echo "Health check failed"
154+ exit 1
You can’t perform that action at this time.
0 commit comments