feat(ci): run db migrations from github ci with environment-scoped secrets#4957
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryHigh Risk Overview CI adds
Reviewed by Cursor Bugbot for commit e141ff1. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR replaces the removed ECS migration sidecar by running database migrations as GitHub CI jobs that gate ECR image pushes, ensuring the schema is migrated before CodePipeline deploys the new app version. The
Confidence Score: 4/5Safe to merge for ECR/CodePipeline consumers; GHCR ARM64 self-hosted users can still pull a pre-migration image on main because The migration-before-ECR-push ordering is correctly implemented for both amd64 (ECR + GHCR) and dev paths. However,
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
push[Push to main/staging/dev]
push --> test_build
push --> detect_version
push --> migrate_dev_check{ref == dev?}
test_build[test-build]
detect_version[detect-version]
test_build --> migrate_check{ref == main/staging?}
migrate_check -->|yes| migrate[migrate\nenvironment=production/staging]
migrate_dev_check -->|yes| migrate_dev[migrate-dev\nenvironment=dev]
migrate --> build_amd64[build-amd64\nECR + GHCR amd64]
detect_version --> build_amd64
test_build --> build_amd64
detect_version --> build_ghcr_arm64[build-ghcr-arm64\nGHCR arm64 only]:::warning
migrate_dev --> build_dev[build-dev\nECR only]
detect_version --> build_dev
build_amd64 --> create_manifests[create-ghcr-manifests]
build_ghcr_arm64 --> create_manifests
classDef warning fill:#ffcccc,stroke:#cc0000,color:#000
Reviews (5): Last reviewed commit: "Revert "improvement(ci): reject pooled (..." | Re-trigger Greptile |
|
@greptile review |
…h Vercel's Production env
… drop github environments
|
@greptile review |
|
@greptile review |
|
@greptile review |
…migrations" This reverts commit 3b80d83.
Summary
feat/decouple-migration): migrations now run as a GitHub CI job that gates the ECR image push, so the schema is migrated before CodePipeline deploys the new app versionmigrations.ymlis now a reusable workflow taking an explicitenvironmentinput (production/staging/dev) that maps to exactly one of the existing repo secrets (DATABASE_URL/STAGING_DATABASE_URL/DEV_DATABASE_URL) — the job never holds another environment's URL, and an unresolved value fails fast instead of falling throughdb:push --forceonly (matching previous sidecar/CI behavior); staging/main apply versioned migrations; dev/staging/main image builds all depend on their migrate jobworkflow_dispatchnow takes an explicit environment choice instead of inferring from the dispatching ref*DATABASE_URLsecrets must be direct (port 5432) connections, not pooled (PgBouncer 6432) — the advisory lock,SET statement_timeout, andCREATE INDEX CONCURRENTLYare all session-scopedType of Change
Testing
bun run lintandbun run check:api-validation:strictpass; workflow YAML validated with actionlint. First real run happens on merge to staging.Checklist
🤖 Generated with Claude Code