CI/CD & Deployment interview question · Most asked

How do you promote a single build artifact from development through staging to production?

How you'd do it Asked in DevOps Engineer · Site Reliability Engineer (SRE) · QA Engineer / SDET interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Build the artifact once, tag it with the Git SHA, push it to a registry, then deploy that exact artifact to each environment. Never rebuild for staging or production — environment-specific configuration comes from environment variables or config files, not from the build.

Longer Answer

The principle is build once, deploy many: the artifact deployed to production is byte-for-byte identical to the one tested in staging. Rebuilding introduces risk — a dependency might have changed, a flaky build step might produce a different result, or a CI environment difference might alter the output.

Promotion flow:

PR build
  → run tests
  → build image, tag with git SHA (e.g. myapp:abc123f)
  → push to registry

Deploy to dev
  → pull myapp:abc123f
  → inject dev config (env vars, ConfigMap)

Deploy to staging
  → pull myapp:abc123f (same image)
  → inject staging config
  → run smoke tests / integration tests

Deploy to production
  → pull myapp:abc123f (same image)
  → inject prod config
  → requires approval gate

Key practices:

  1. Immutable tags: tag with the Git SHA, not latest or v1. This guarantees traceability — you always know which commit is running.
  2. Environment config is external: the image contains the application; environment variables, Kubernetes ConfigMaps or SSM parameters provide the config. The image itself is environment-agnostic.
  3. Registry as source of truth: the container registry (ECR, GCR, Docker Hub) holds every version. Rollback means redeploying a previous SHA, not rebuilding.
  4. Approval gates: production deployments require manual approval (GitHub environments, ArgoCD sync policies, Spinnaker pipelines).
  5. Verification at each stage: smoke tests after each deployment verify the artifact works in that environment before promoting to the next.

What not to do:

  • Rebuild the image for each environment (different dependencies, non-reproducible).
  • Use :latest tags (you can't tell what's deployed or roll back deterministically).
  • Bake environment config into the image (one image per environment = three builds).

Key Points

  • Build once, tag with Git SHA, deploy the same artifact to every environment
  • Environment config comes from env vars or config maps, never baked into the image
  • Immutable tags (Git SHA) guarantee traceability and deterministic rollbacks
  • Approval gates and smoke tests at each stage before promoting further

Explanation

What interviewers look for

Look for the "build once, deploy many" principle. Weak answers rebuild per environment or use mutable tags. Strong answers explain why immutability matters for rollbacks and audit trails.

More CI/CD & Deployment questions

← All CI/CD & Deployment questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake