CI/CD · Ship safely, repeatedly
What is a build artifact and why should you build once?
Short answer
A build artifact is the versioned immutable output of a build, such as a container image, jar or JavaScript bundle. Build it once, verify it, and promote the same bytes through every environment.
Building once removes a major source of release drift. If staging compiles from source and production compiles again later, a dependency resolution difference or toolchain change can make production run something that was never tested.
- Identify artifacts by content or an immutable version, not by a mutable tag such as latest
- Store a checksum or digest alongside the artifact so consumers can verify integrity
- Record the source commit, build inputs and toolchain version for traceability
- Promote by reference between environments rather than copying or rebuilding
- Retain artifacts long enough to support rollback and audit
sha256sum dist/app.tar.gz > dist/app.tar.gz.sha256
docker build -t registry.example.com/app:1.8.3 .
docker push registry.example.com/app:1.8.3
docker inspect --format '{{index .RepoDigests 0}}' registry.example.com/app:1.8.3Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How do you version an artifact?
- 2What is the difference between a tag and a digest?
- 3How long should you retain old artifacts?
- 4What happens if the artifact registry is unavailable during a rollback?
Say it in the interview
An artifact is the immutable output of a build, and I build it once so the tested bytes are exactly what reaches production. I identify it by a version and preferably a digest, store its checksum and provenance, and promote it by reference. Rebuilding per environment is a common cause of drift. I also keep enough retention to make rollback possible.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live CI/CD mock interview and get scored feedback on depth, clarity and confidence.