Skip to content

Commit 0efe20d

Browse files
author
Jonathan Alvarez Delgado
committed
fix(ci): suspend autoscaling before scale-to-0, add workflow paths to validate filter
1 parent 1d2a1e7 commit 0efe20d

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/deploy-stage.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,24 @@ jobs:
121121
run: |
122122
echo "Scaling ECS services to 0 (safety: prevents writes to shared stage DB)"
123123
echo "Scale up manually after RO healthcheck validation"
124+
PREFIX="thunderbird-addons-stage"
124125
for svc in web worker versioncheck; do
126+
CLUSTER="${PREFIX}-${svc}"
127+
SERVICE="${PREFIX}-${svc}"
128+
RESOURCE_ID="service/${CLUSTER}/${SERVICE}"
129+
130+
echo " Suspending autoscaling for ${svc}..."
131+
aws application-autoscaling register-scalable-target \
132+
--service-namespace ecs \
133+
--scalable-dimension ecs:service:DesiredCount \
134+
--resource-id "${RESOURCE_ID}" \
135+
--suspended-state '{"DynamicScalingInSuspended":true,"DynamicScalingOutSuspended":true,"ScheduledScalingSuspended":true}' \
136+
--region ${{ env.AWS_REGION }} 2>/dev/null || echo " (no autoscaling target for ${svc}, skipping)"
137+
138+
echo " Scaling ${svc} to 0..."
125139
aws ecs update-service \
126-
--cluster thunderbird-addons-stage-${svc} \
127-
--service thunderbird-addons-stage-${svc} \
140+
--cluster "${CLUSTER}" \
141+
--service "${SERVICE}" \
128142
--desired-count 0 \
129143
--region ${{ env.AWS_REGION }} \
130144
--query 'service.[serviceName,desiredCount]' \

.github/workflows/validate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- 'infra/pulumi/**'
3737
- 'infra/tests/**'
3838
- 'infra/scripts/**'
39+
- '.github/workflows/*.yml'
3940
4041
validate-iac:
4142
needs: detect-changes

0 commit comments

Comments
 (0)