Stamp image tags from STABLE_ status keys - #359
Merged
Conversation
BUILD_SCM_REVISION and BUILD_SCM_TIMESTAMP have no STABLE_ prefix, so Bazel files them in volatile-status.txt and reports an unchanging digest for that file whatever it contains. The expand_template that builds the image tag is therefore never invalidated, and _stamped.tags.txt is generated once and reused indefinitely. Ephemeral CI never sees this, since each job starts with an empty cache. On a build machine whose cache persists, every later build pushes its image to the tag produced by the first build on that machine, silently overwriting what was published there before. See buildbarn#358. A commit SHA belongs in the stable bucket: it changes rarely, and when it does, artifacts built from it should be rebuilt. Verified by building //tools:stamped_tags, moving HEAD, and rebuilding with nothing else touched: the action re-runs and the tag follows the new commit. Before this change it stayed frozen at the first value.
EdSchouten
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #358.
BUILD_SCM_REVISIONandBUILD_SCM_TIMESTAMPhave noSTABLE_prefix, so Bazel files them involatile-status.txtand reports an unchanging digest for that file whatever it contains. Theexpand_templatebehind//tools:stamped_tagsis therefore never invalidated, and_stamped.tags.txtis generated once and reused indefinitely.Ephemeral CI never sees this — each job starts with an empty cache, so the action always re-executes. On a build machine whose cache persists, every later build pushes its image to the tag produced by the first build on that machine, silently overwriting what was published there before. We hit this on a self-hosted runner: four months of builds published new content to one April tag.
A commit SHA belongs in the stable bucket. It changes rarely, and when it does, artifacts built from it should be rebuilt — which is exactly what the prefix buys.
Verification
Built
//tools:stamped_tags, moved HEAD, rebuilt with nothing else touched:The action re-runs and the tag follows the commit. Before this change it stayed frozen at the first value indefinitely.
Coordination note
bb-remote-execution,bb-remote-assetandbb-portaleach ship their owntools/workspace-status.shand consume this template via--override_module, so they need the same rename. Until they have it, their builds will emit the literal string{{STABLE_BUILD_SCM_TIMESTAMP}}-{{STABLE_BUILD_SCM_REVISION}}as the tag — visibly broken and a failed push, rather than a plausible-looking wrong tag. Happy to send the matching PRs to those repos so they can land together.