You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(ci): CI fails when an image digest depends on the commit (#1378) - #1467
Top of a three-PR stack for #1378. The two PRs below remove the two stamps that gave every image a new digest with every commit. This one keeps them from coming back.
scripts/check-image-digest-stability.sh holds the Go images of the root workspace (every image_index target: agent, mesh-dns, proxy-supervisor, uds-csi, cni-install, registrar, controller, prober and the two e2e fixtures) to "the digest does not depend on the commit", in two lines of defence.
Out of scope: the aether-proxy image. It is built in the nested proxy/ workspace by its own release workflow and carries the aether commit on purpose (its revision label and Envoy's own version linkstamp). The chart pins it statically, so it changes only when the pin is bumped.
First, the action graph, with no build:
bazel aquery over the dependencies of every index fails if any action there takes stable-status.txt or volatile-status.txt as an input (or the two headers Bazel derives from them), and names the action. Both files are asserted: nothing under an image takes either. One target is allowed, Bazel's own @bazel_tools//tools/build_defs/build_info:cc_build_info, which is in every toolchain's dependencies. The image_push targets are not dependencies of an index and stay free to read the status; they are added to the query as its control (each must appear, or the query saw no status input at all).
Then the build, twice under --stamp, each time with a workspace-status script that reports a different made-up commit:
an index digest that differs between the two builds fails (it names the image);
a push's per-commit tag (dev-<sha>) must name the first commit after the first build and the second after the second. This is the control: it proves the made-up status reached the build;
the real bazel/workspace_status.sh must report STABLE_GIT_COMMIT = HEAD. Without a STABLE_ key that changes with the commit, a warm Bazel server keeps the previous commit's tag.
It runs as a step of the test job in ci.yaml and as make check-image-digests. The images are found with a query, not a list, so a new image is covered without an edit. The exit status of the query, the action query and the status script is read before their output is used.
//scripts:check_image_digest_stability_test runs the script against a fake bazel, twelve cases: stable digests pass; a digest that follows the commit; a tag that does not; a status that never reaches the build; an action under an image that takes a status file while both builds agree; a query or action query that fails or comes back empty; a build that writes no digest; a status script that fails or has no STABLE_GIT_COMMIT.
Why a CI step and not a Bazel test
The check has to run Bazel under two different workspace statuses. A test cannot do that: the status is one global input of a build, not something a rule or a transition can vary. So the script is a step, like the linkage guards next to it, and its logic is what the Bazel test covers.
It sits in the test job, not a job of its own, because it is cheap there by construction: nothing in an image reads the workspace status, so the first build is a cache hit on images the job's build step (or main) already built, and the second re-runs the tag expansions only. Warm, on a developer machine: 6 s for the whole script; the second build ran 21 actions, no compile and no link. If a regression makes it expensive, that is the same regression check 1 reports.
Red, then green
On the real build, each mutation applied and then reverted:
Mutation
Result
the x_defs version back on mesh-dns alone
exit 1: //agent/cmd/mesh-dns:image_index differs; the other nine ok
the revision label, the annotations and stamp = "force" back in the image macro
exit 1: all 10 digests differ
the revision label back on the volatileGIT_COMMIT
exit 1: the action query names the ExpandTemplate action of each image_manifest and image_index (20 failures)
none (this stack)
exit 0, 10 of 10
The third row is the one the builds alone cannot see. Measured with that mutation and two statuses that differ only in the volatile key: the mesh-dns index digest was the same for both commits, with the first commit baked into it.
Seen red in the hermetic test, against the script before each fix: a fake query that printed one image and exited 3 ended in OK: 1 of 1, exit 0.
Cost: 4 s for the whole script warm, 14 s with a cold Bazel server, on a developer machine; the action query itself took 1 to 5 s. On the runner the step took 69 s before the action query was added.
Also clean: make format-check, the lint build with fail_on_violation (ShellCheck included), scripts/check-shell-lint.sh, //bazel/actionlint:actionlint_test.
Not verified
On a runner the step was timed once under --config=ci, before the action query was added: it passed in 69 s. The action query under --config=ci (remote configuration, lint aspects) has only run locally with the lint half of that configuration; this head's CI run is its first on a runner, and its cost there is not measured. The step has not been seen red on a runner, only locally and in the Bazel test.
A commit that reaches an image without going through the workspace status (a rule that reads the repository itself) is seen by neither line of defence.
The allow-listed cc_build_info target is a Bazel internal: a Bazel upgrade that renames it would turn the step red, loudly, and the script would need the new name.
main.yaml mirrors the linkage guards for pushes to main; this step is in ci.yaml only.
Merge order
No constraint of its own beyond the stack: it fails without the two PRs below it. For the order against the publish PR, see the PR below this one.
Add commit-dependent digest guard to post-merge workflow
.github/workflows/ci.yaml:655
This guard is only added to the PR workflow. The repository’s post-merge workflow explicitly revalidates combined PR state and mirrors every adjacent linkage guard (.github/workflows/main.yaml:3-24, 172-198), but it does not run this check. As a result, a commit-dependent digest introduced by the merged tree has no post-merge detector. Add the same guarded step to main.yaml’s test job.
The charts pin every image by index digest, so a digest that moves with the
commit rolls every workload on every deploy. Two stamps did that (a version
linked into seven binaries, and the commit as an image label and annotation);
both are gone, and nothing stopped either from coming back.
`scripts/check-image-digest-stability.sh` builds every `image_index` twice
under `--stamp`, each time with a workspace-status script of its own that
reports a different made-up commit, and fails when:
1. an index digest differs between the two (it names the image);
2. a push's per-commit tag (`dev-<sha>`) does not name the first commit after
the first build and the second after the second. This is the control: it
proves the made-up status reached the build, so check 1 did not compare a
thing with itself;
3. the real `bazel/workspace_status.sh` does not report
`STABLE_GIT_COMMIT` = HEAD. With no STABLE_ key that changes with the
commit, a warm Bazel server keeps the previous commit's tag (measured).
It is a step of the `test` job in ci.yaml and `make check-image-digests`
locally. It cannot be a Bazel test: it has to run Bazel under two workspace
statuses. Its failure paths are a Bazel test,
`//scripts:check_image_digest_stability_test`, against a fake `bazel`.
Seen red with each stamp put back, on the real build:
- the `x_defs` version back on mesh-dns alone: 1 check failed, naming
//agent/cmd/mesh-dns:image_index, the other nine ok;
- the `revision` label, annotations and `stamp = "force"` back in the image
macro: 10 checks failed, one per image.
Green on this stack: 10 of 10. Warm, the whole run took 6 s here: the second
build re-ran 21 actions (the tag expansions), no compile and no link.
It does not see a value taken from a volatile status key: Bazel does not
re-run an action for one, so two warm builds agree.
Part of #1378
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
… that failed (#1378)
Review of the digest check. The image list came from
`mapfile < <(bazel query … | sort)`, where the query's exit status is lost
twice, in the pipe and in the process substitution. A query that printed some
images and then failed left the script checking those and reporting success.
The query's status is now read before its output is used.
The same shape was in the read of the real workspace status
(`x="$(script | sed)"`): a failing script ended the check with the script's own
status and no line saying why. It now fails with a message.
The two builds are plain commands under `set -e`, the cquery already had its
status checked, and a digest that was not written is caught by the digest's
shape; none of those changed.
`//scripts:check_image_digest_stability_test` has both cases. Seen red against
the previous script: a fake query that printed one image and exited 3 ended in
"OK: 1 of 1 image digests", exit 0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…s key in an image is caught too (#1378)
Review of the digest check, two points.
Scope. The script, its messages and the comments around it said "every image
this repository builds". It checks the `image_index` targets of the root
workspace, the Go images. The aether-proxy image is built in the nested proxy/
workspace by its own workflow and carries the commit on purpose; it is named as
out of scope.
The volatile blind spot. Bazel does not re-run an action when only a volatile
status key changed, so the two warm builds agree on an image that embeds one.
Measured with the revision label put back on the volatile `GIT_COMMIT` and two
statuses that differ only in that key: the mesh-dns index digest was the same
for both commits (sha256:2b900348…) with the first commit baked in.
The check now has a first line of defence that does not depend on a rebuild:
`bazel aquery` for actions with `stable-status.txt` or `volatile-status.txt`
(or the two headers Bazel derives from them) among their inputs, over the
dependencies of every image index. Any hit fails and names the action. Both
files are asserted: after the image change nothing under an image takes
either. One target is allowed, Bazel's own
`@bazel_tools//tools/build_defs/build_info:cc_build_info`, which is in every
toolchain's dependencies. The `image_push` targets are not dependencies of an
index; they are added to the query as its control, because each must read the
status, and are the only other targets allowed to.
Seen red on the real build with that mutation: twenty failures naming the
ExpandTemplate action of each `image_manifest` and `image_index`. The hermetic
test has three new cases (an action under an image that takes a status file
while both builds agree; an action query that fails; one that reports no
push); twelve in all.
Cost: the whole script took 4 s warm and 14 s with a cold Bazel server here;
the aquery itself 1 to 5 s.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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
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.
Top of a three-PR stack for #1378. The two PRs below remove the two stamps that gave every image a new digest with every commit. This one keeps them from coming back.
Part of #1378
What
scripts/check-image-digest-stability.shholds the Go images of the root workspace (everyimage_indextarget: agent, mesh-dns, proxy-supervisor, uds-csi, cni-install, registrar, controller, prober and the two e2e fixtures) to "the digest does not depend on the commit", in two lines of defence.Out of scope: the
aether-proxyimage. It is built in the nestedproxy/workspace by its own release workflow and carries the aether commit on purpose (its revision label and Envoy's own version linkstamp). The chart pins it statically, so it changes only when the pin is bumped.First, the action graph, with no build:
bazel aqueryover the dependencies of every index fails if any action there takesstable-status.txtorvolatile-status.txtas an input (or the two headers Bazel derives from them), and names the action. Both files are asserted: nothing under an image takes either. One target is allowed, Bazel's own@bazel_tools//tools/build_defs/build_info:cc_build_info, which is in every toolchain's dependencies. Theimage_pushtargets are not dependencies of an index and stay free to read the status; they are added to the query as its control (each must appear, or the query saw no status input at all).Then the build, twice under
--stamp, each time with a workspace-status script that reports a different made-up commit:dev-<sha>) must name the first commit after the first build and the second after the second. This is the control: it proves the made-up status reached the build;bazel/workspace_status.shmust reportSTABLE_GIT_COMMIT= HEAD. Without a STABLE_ key that changes with the commit, a warm Bazel server keeps the previous commit's tag.It runs as a step of the
testjob inci.yamland asmake check-image-digests. The images are found with a query, not a list, so a new image is covered without an edit. The exit status of the query, the action query and the status script is read before their output is used.//scripts:check_image_digest_stability_testruns the script against a fakebazel, twelve cases: stable digests pass; a digest that follows the commit; a tag that does not; a status that never reaches the build; an action under an image that takes a status file while both builds agree; a query or action query that fails or comes back empty; a build that writes no digest; a status script that fails or has noSTABLE_GIT_COMMIT.Why a CI step and not a Bazel test
The check has to run Bazel under two different workspace statuses. A test cannot do that: the status is one global input of a build, not something a rule or a transition can vary. So the script is a step, like the linkage guards next to it, and its logic is what the Bazel test covers.
It sits in the
testjob, not a job of its own, because it is cheap there by construction: nothing in an image reads the workspace status, so the first build is a cache hit on images the job's build step (or main) already built, and the second re-runs the tag expansions only. Warm, on a developer machine: 6 s for the whole script; the second build ran 21 actions, no compile and no link. If a regression makes it expensive, that is the same regression check 1 reports.Red, then green
On the real build, each mutation applied and then reverted:
x_defsversion back on mesh-dns alone//agent/cmd/mesh-dns:image_indexdiffers; the other nineokrevisionlabel, the annotations andstamp = "force"back in the image macrorevisionlabel back on the volatileGIT_COMMITimage_manifestandimage_index(20 failures)The third row is the one the builds alone cannot see. Measured with that mutation and two statuses that differ only in the volatile key: the mesh-dns index digest was the same for both commits, with the first commit baked into it.
Seen red in the hermetic test, against the script before each fix: a fake query that printed one image and exited 3 ended in
OK: 1 of 1, exit 0.Cost: 4 s for the whole script warm, 14 s with a cold Bazel server, on a developer machine; the action query itself took 1 to 5 s. On the runner the step took 69 s before the action query was added.
Also clean:
make format-check, the lint build withfail_on_violation(ShellCheck included),scripts/check-shell-lint.sh,//bazel/actionlint:actionlint_test.Not verified
--config=ci, before the action query was added: it passed in 69 s. The action query under--config=ci(remote configuration, lint aspects) has only run locally with the lint half of that configuration; this head's CI run is its first on a runner, and its cost there is not measured. The step has not been seen red on a runner, only locally and in the Bazel test.cc_build_infotarget is a Bazel internal: a Bazel upgrade that renames it would turn the step red, loudly, and the script would need the new name.main.yamlmirrors the linkage guards for pushes to main; this step is inci.yamlonly.Merge order
No constraint of its own beyond the stack: it fails without the two PRs below it. For the order against the publish PR, see the PR below this one.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr