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 →
- CI builds one image, tagged with the Git SHA, and records its digest.
- Each environment differs only in config (values files, ConfigMaps, secrets), never in the image.
- 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
- 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.
More on Multi-env and multi-account
Design the AWS account structure for a 50-engineer startup that's growing fast.IntermediateBugs keep passing staging and appearing in production. How do you make staging closer to prod?IntermediateHow do you structure Terraform for dev, staging and prod? Workspaces, directories or Terragrunt?IntermediateDevelopers want a preview environment for every pull request. How would you build it?AdvancedHelm values files or Kustomize overlays for per-environment config?BeginnerCI runs in a shared tools account and must deploy to dev, staging and prod accounts. How do you set up access?Intermediate