Interview Prep/GitHub Actions/Pipeline Design & Triggers

A database migration must run once per deploy, before the app rolls out, with approval in prod. How do you model it?

AdvancedScenarioPipeline Design & Triggers
Answer

Situation read → Ordered, gated, and must not run concurrently.

What I'd do →

  1. Separate job migrate with environment: prod and concurrency: { group: migrate-prod, cancel-in-progress: false }.
  2. Run the migration as a Kubernetes Job using the same image digest (kubectl apply then kubectl wait --for=condition=complete job/migrate-<sha> --timeout=10m).
  3. deploy has needs: migrate.
  4. Migrations are backward compatible (expand and contract), so rollback of the app does not require rolling back the schema.

Why → Approval once, ordering guaranteed by needs, no parallel migrations thanks to concurrency.

Interview tip → Mention expand and contract; interviewers look for schema rollback awareness.

All GitHub Actions questions Roadmap: GitHub Actions

More on Pipeline Design & Triggers