File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,11 +69,31 @@ jobs:
6969 echo "$( jq --arg image "${{ steps.config.outputs.TARGET_IMAGE_W_DIGEST }}" '.containerDefinitions |= map((select(.name == "gateway") | .image) |= $image)' task.json )" > task.json
7070 cat task.json
7171
72-
7372 - name : Deploy Amazon ECS task definition
73+ id : ecs-deploy
7474 uses : aws-actions/amazon-ecs-deploy-task-definition@v2
7575 with :
7676 task-definition : task.json
7777 service : ${{ vars.ECS_SERVICE }}
7878 cluster : ${{ vars.ECS_CLUSTER }}
79- wait-for-service-stability : true
79+ wait-for-service-stability : true
80+ propagate-tags : SERVICE
81+
82+ - name : Verify deploy
83+ id : check-deployment
84+ run : |
85+ TASK_DEF_EXPECTED=${{ steps.ecs-deploy.outputs.task-definition-arn }}
86+ TASK_DEF_CURRENT=$(
87+ aws ecs describe-services \
88+ --cluster ${{ vars.ECS_CLUSTER }} \
89+ --services ${{ vars.ECS_SERVICE }} \
90+ --query services[0].deployments[0].taskDefinition \
91+ | jq -r "."
92+ )
93+ echo "Task Arn - Current: $TASK_DEF_CURRENT"
94+ echo "Task Arn - Expected: $TASK_DEF_EXPECTED"
95+ if [ "$TASK_DEF_CURRENT" != "$TASK_DEF_EXPECTED" ]; then
96+ echo "Current task arn does not match the expected task arn."
97+ echo "The deployment may have been rolled back or been deposed by a more recent deployment attempt"
98+ exit 1
99+ fi
You can’t perform that action at this time.
0 commit comments