Skip to content

Commit

Permalink
feat: verify deployed task definition
Browse files Browse the repository at this point in the history
If ECS circuit breaker is enabled for a service the ECS deploy step can
give a false successful result, as the triggered rollback is detected as
"healthy".

The task definition ARN can be checked against the expectation as a
workaround.
See:
aws-actions/amazon-ecs-deploy-task-definition#191

TIS21-4819
TIS21-5327
  • Loading branch information
Judge40 committed Nov 8, 2023
1 parent fd4e3df commit 96f14c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,21 @@ jobs :
image: ${{ steps.login-ecr.outputs.registry }}/${{ github.event.repository.name }}:${{ github.sha }}

- name: Deploy Amazon ECS task definition
id: ecs-deploy
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ inputs.service-name }}
cluster: ${{ inputs.cluster-prefix }}-${{ inputs.environment }}
wait-for-service-stability: true

- name: Verify ECS deployment
run: |
CURRENT_TASK_DEF_ARN=$(aws ecs describe-services --cluster ${{ inputs.cluster-prefix }}-${{ inputs.environment }} --service ${{ inputs.service-name }} --query services[0].deployments[0].taskDefinition | jq -r ".")
NEW_TASK_DEF_ARN=${{ steps.ecs-deploy.outputs.task-definition-arn }}
echo "Current task arn: $CURRENT_TASK_DEF_ARN"
echo "New task arn: $NEW_TASK_DEF_ARN"
if [ "$CURRENT_TASK_DEF_ARN" != "$NEW_TASK_DEF_ARN" ]; then
echo "Deployment failed."
exit 1
fi

0 comments on commit 96f14c7

Please sign in to comment.