Skip to content

Commit 217f217

Browse files
ci: add check for failed deployments (#6549)
1 parent 007ff8a commit 217f217

4 files changed

Lines changed: 53 additions & 1 deletion

File tree

.github/actions/api-deploy-ecs/action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,28 @@ runs:
153153
aws ecs wait services-stable --cluster ${{ inputs.aws_ecs_cluster_name }} --services ${{ inputs.aws_ecs_service_name }}
154154
aws ecs wait services-stable --cluster ${{ inputs.aws_ecs_cluster_name }} --services ${{ inputs.aws_ecs_sdk_service_name }}
155155
shell: bash
156+
157+
- name: Verify correct version is running
158+
shell: bash
159+
run: |
160+
EXPECTED_TASK_DEF=${{ steps.deploy-api-task-def.outputs.task-definition-arn }}
161+
RUNNING_ADMIN_API_TASK_DEF=$(aws ecs describe-services \
162+
--cluster ${{ inputs.aws_ecs_cluster_name }} \
163+
--services ${{ inputs.aws_ecs_service_name }} \
164+
--query 'services[0].deployments[?status==`PRIMARY`].taskDefinition' \
165+
--output text)
166+
RUNNING_SDK_API_TASK_DEF=$(aws ecs describe-services \
167+
--cluster ${{ inputs.aws_ecs_cluster_name }} \
168+
--services ${{ inputs.aws_ecs_sdk_service_name }} \
169+
--query 'services[0].deployments[?status==`PRIMARY`].taskDefinition' \
170+
--output text)
171+
if [[ "$RUNNING_ADMIN_API_TASK_DEF" == "$EXPECTED_TASK_DEF" && \
172+
"$RUNNING_SDK_API_TASK_DEF" == "$EXPECTED_TASK_DEF" ]]; then
173+
exit 0
174+
else
175+
echo "Task definition mismatch detected"
176+
echo "Expected: $EXPECTED_TASK_DEF"
177+
echo "Admin API running: $RUNNING_ADMIN_API_TASK_DEF"
178+
echo "SDK API running: $RUNNING_SDK_API_TASK_DEF"
179+
exit 1
180+
fi

.github/actions/task-processor-deploy-ecs/action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ runs:
4141
image: ${{ inputs.api_ecr_image_url }}
4242

4343
- name: Deploy Amazon ECS Task Processor task definition
44+
id: deploy-task-processor-task-def
4445
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
4546
with:
4647
cluster: ${{ inputs.aws_ecs_cluster_name }}
@@ -52,3 +53,21 @@ runs:
5253
aws ecs wait services-stable --cluster ${{ inputs.aws_ecs_cluster_name }} --services ${{
5354
inputs.aws_ecs_service_name }}
5455
shell: bash
56+
57+
- name: Verify correct version is running
58+
shell: bash
59+
run: |
60+
EXPECTED_TASK_DEF=${{ steps.deploy-task-processor-task-def.outputs.task-definition-arn }}
61+
RUNNING_TASK_DEF=$(aws ecs describe-services \
62+
--cluster ${{ inputs.aws_ecs_cluster_name }} \
63+
--services ${{ inputs.aws_ecs_service_name }} \
64+
--query 'services[0].deployments[?status==`PRIMARY`].taskDefinition' \
65+
--output text)
66+
if [[ "$RUNNING_TASK_DEF" == "$EXPECTED_TASK_DEF" ]]; then
67+
exit 0
68+
else
69+
echo "Task definition mismatch detected"
70+
echo "Expected: $EXPECTED_TASK_DEF"
71+
echo "Task Processor running: $RUNNING_TASK_DEF"
72+
exit 1
73+
fi

.github/workflows/api-deploy-production-ecs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
- .github/**
1010
- infrastructure/aws/production/**
1111

12+
concurrency:
13+
group: ${{ github.workflow }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
deploy-ecs:
1418
uses: ./.github/workflows/.reusable-deploy-ecs.yml

.github/workflows/api-deploy-staging-ecs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ on:
1010
- infrastructure/aws/staging/**
1111
workflow_dispatch:
1212

13+
concurrency:
14+
group: ${{ github.workflow }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
deploy-ecs:
1519
uses: ./.github/workflows/.reusable-deploy-ecs.yml
1620
with:
1721
environment: staging
18-
secrets: inherit
22+
secrets: inherit

0 commit comments

Comments
 (0)