Consolidate ECS CD pipeline (Phases 2-5) into dev - #112
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 reacheddev. This PR carries everything from that chain over in one go, sincefeat/ecs-explicit-migration-taskalready contains all of it:if: always()(ran even on cancellation) and the squash-merge-unsafe CloudFormation-change conditionNo 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 ECSwas 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 ondev— 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.