Skip to content

Consolidate ECS CD pipeline (Phases 2-5) into dev - #112

Merged
saqibmanan merged 7 commits into
devfrom
feat/ecs-explicit-migration-task
Aug 18, 2026
Merged

Consolidate ECS CD pipeline (Phases 2-5) into dev#112
saqibmanan merged 7 commits into
devfrom
feat/ecs-explicit-migration-task

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

Summary

#109, #110, and #111 were each merged into their stacked parent branch instead of dev (no auto-retarget happens unless the parent branch is deleted after merge) — so only #108 actually reached dev. This PR carries everything from that chain over in one go, since feat/ecs-explicit-migration-task already contains all of it:

No new changes here — this is purely landing already-reviewed, already-merged work onto the branch the pipeline actually triggers from.

Heads up: Deploy to Amazon ECS was just re-enabled (it had been silently disabled, which is why nothing ran when #108 merged). Merging this PR will trigger a real deploy against AWS the moment it lands on dev — build, push to ECR, run migrations, update the ECS service, run the full smoke suite, and roll back automatically if smoke fails. First real run of the new pipeline.

github.event.head_commit.modified is only populated for single-commit
pushes -- a squash-merge touching aws/cloudformation would silently
skip infra sync. The CFN deploy is already idempotent
(--no-fail-on-empty-changeset), so simplest robust fix is to just run
it every time; costs one extra ~10-20s idempotent call per deploy.
if: always() made this job run even if the workflow was cancelled
before it started. Now that deploy-infrastructure always runs (prior
commit), it can never legitimately be 'skipped' either, so the
implicit needs: gating (success-only, false on cancellation) is
exactly the behavior wanted -- no explicit if: needed.
Bumps aws-actions/amazon-ecs-deploy-task-definition v1 -> v2 (purely
additive per its changelog) to use its built-in run-task support:
runs a standalone task on the new task definition, waits for it to
stop, and fails the whole action on a non-zero container exit --
before the service update ever happens. Network config (subnets,
security groups, public-IP assignment) is read from the currently
running service via describe-services rather than hardcoded, so the
migration task always runs in the same network context as the app.
mkdir/chmod/touch on api/migrations existed only to let the runtime
makemigrations step (removed earlier) write new migration files.
migrate doesn't need to write to that directory, just read committed
migrations, so this block has been dead weight since makemigrations
was dropped.
Adds a smoke-tests job calling CivicDataSpace-test's run-smoke.yml,
passing deployed_sha (github.sha) so the gate verifies /health/'s
git_sha field matches, and min_passed to catch a fully-skipped run
looking green. Requires a new repo variable DEV_API_BASE_URL and the
same secrets DataSpaceFrontend's own pipeline already passes to this
workflow (HOME_URL_DEV, TEST_EMAIL_1/2, TEST_PASSWORD_1/2).

Also captures the currently-running task definition ARN before the
service update (deploy-app now has an output for it) -- needed by the
rollback job that follows in the next commit.
Restores the task definition ARN captured before this deploy's service
update (previous commit), waits for the rolled-back service to
stabilize, then exits 1 -- the run stays red even after successful
mitigation, matching the policy that a rollback is damage control, not
a pass. Migrations applied by the bad deploy are never auto-reverted;
the error message points at where to find what ran.

OTel collector rollback is explicitly out of scope here -- separate
service, independent risk, keeps this change's blast radius to the
app service only.
Add smoke-test gate and auto-rollback to the ECS deploy
@saqibmanan
saqibmanan merged commit 011d66e into dev Aug 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant