Interview Prep/Real-World Interview/Multi-env and multi-account

How do you promote the same build from dev to staging to prod?

BeginnerScenarioMulti-env and multi-account
Answer

Situation read → Build once, deploy the same artifact everywhere. Rebuilding per environment means prod runs something you never tested.

What I'd do →

  1. CI builds one image, tagged with the Git SHA, and records its digest.
  2. Each environment differs only in config (values files, ConfigMaps, secrets), never in the image.
  3. Promotion is changing the image tag or digest in the next environment's config, through a PR or a pipeline step after the previous environment's checks pass.
yq -i '.image.digest = "sha256:3f1c..."' envs/prod/values.yaml
  1. If environments are in different accounts, replicate the image to each account's ECR or grant cross-account pull from a shared registry.

Why → The thing you tested in staging is byte-for-byte the thing that runs in prod.

Interview tip → Say "promote the digest, not the tag"; tags can be overwritten.

All Real-World Interview questions Roadmap: Interview readiness

More on Multi-env and multi-account