Skip to content

Commit 6518cc5

Browse files
authored
loop wait
1 parent d95b220 commit 6518cc5

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/deploy.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ jobs:
4545
env:
4646
SERVICE_NAME: ab2d-${{ vars[format('{0}_DEPLOYMENT_ENV', inputs.environment)] }}-${{ inputs.module }}
4747
run: |
48-
echo "Deploying ECS service: $SERVICE_NAME"
48+
echo "Deploying service $SERVICE_NAME"
4949
aws ecs update-service --cluster "$SERVICE_NAME" --service "$SERVICE_NAME" --force-new-deployment > /dev/null
50-
echo "Waiting for new task to start..."
51-
sleep 10
52-
TASK_ARN=$(aws ecs list-tasks --cluster "$SERVICE_NAME" --service-name "$SERVICE_NAME" --desired-status RUNNING --query 'taskArns[-1]' --output text)
53-
echo "New task: $TASK_ARN"
54-
exit_status="1"
55-
while [ "${exit_status}" != "0" ]; do
56-
echo "Waiting for task to stop..."
57-
aws ecs wait tasks-stopped --cluster "$SERVICE_NAME" --tasks "$TASK_ARN"
50+
51+
echo "Waiting for ECS service to stabilize..."
52+
exit_status=1
53+
while [ "$exit_status" != "0" ]; do
54+
aws ecs wait services-stable --cluster "$SERVICE_NAME" --services "$SERVICE_NAME"
5855
exit_status="$?"
56+
echo "Wait result: $exit_status"
5957
done
58+
59+
echo "✅ ECS service stabilized."

0 commit comments

Comments
 (0)