Your Cloud Build config produces an image for an Artifact Registry repository. The release team wants each build pushed with an immutable commit-SHA tag and also with a moving tag that always points at the newest build. How should the images section be written?
Show answer and explanation
Answer: B
Cloud Build pushes every image listed in the images field after the build succeeds. Listing the same image under two tags, the commit SHA and a moving tag, gives an immutable reference for rollbacks and audits plus a convenient name for the newest build. Each entry needs the full registry path, including the repository.
Why the other options are wrong
- A. Cloud Build does not create a SHA tag on its own. The images field must name every tag to push, so omitting the SHA leaves no immutable reference.
- C. Unique names for every build lose the stable moving tag the release team relies on for the newest version. It complicates deployment references without adding a real benefit.
- D. A scheduled retag runs on the wrong timescale and adds a moving part outside the pipeline. The image would be stale between runs and the pipeline would not record it.