FoundationCI/CD

Why should the same build artifact be promoted through environments instead of rebuilding for each one?

What they are really testing: Whether you understand that a rebuild breaks the entire logic of testing. This is a favourite because it sounds pedantic but exposes whether someone has actually thought about what a passing test proves.

A real interview question

Why should the same build artifact be promoted through environments instead of rebuilding for each one?

What most people say

drag me

It is faster because you do not have to build the same thing three times.

Speed is a side effect. The candidate misses the correctness argument entirely, which means they would happily approve a pipeline that rebuilds per environment and silently invalidates its own testing.

The follow-ups they ask next

  • What has to be true about your app for that to work?

    Config has to be external, so environment variables, mounted config, or a secrets manager, never compiled in. That is the 12-factor config principle.

  • How do you make sure the artifact you deploy really is the one you tested?

    Immutable tags by commit sha rather than mutable tags like latest, and ideally digest pinning plus artifact signing so the pipeline can verify provenance before deploy.

What the interviewer is listening for

  • Leads with the correctness argument
  • Gives a concrete way builds can differ
  • Knows config must be externalised

What sinks the answer

  • Only cites build time
  • Comfortable with per-environment builds
  • Uses mutable tags like latest for deploys

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

Because [a green test proves that specific artifact works, not the source]. Rebuilding means [you ship something you never tested], since [dependencies or base images can move]. So [build once, tag by commit sha, promote the same artifact] and [inject config at runtime].

Keep going with ci/cd

All 87 devops engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free