Repository navigation
fix: annotate the aether-proxy index (#847), and put the proxy workspace's shell under make lint (#848) - #854
Merged
Conversation
`proxy/bazel/image_metadata.sh` and the two `proxy/integration/check_*.sh`
were not linted by anything. `proxy` is in //.bazelignore, so root tooling
never descends into it; a hand-run of shellcheck for the PR that added the
first one does not survive the next edit.
The ignore stays. //proxy is a separate bzlmod workspace pinned to its own
Bazel version whose //:image is a multi-hour Envoy compile, and a root build
must not analyse any of that. Instead //bazel/lint/proxy_shell reaches the
scripts the way //website:staged/proxy-README.md already reaches
proxy/README.md: source symlinks in a non-ignored directory. A label under an
ignored directory resolves but is never staged into a sandbox; a symlink to it
is an ordinary source file of the linting package. sh_library, because that is
the rule kind lint_shellcheck_aspect visits.
Three things keep it honest:
* scripts/check-proxy-shell-lint.sh fails on any difference between the set
of //proxy shell scripts and the set of symlinks — a missing one (the
script would silently go unlinted again), a stale one, or a symlink
replaced by a copy, which would drift;
* a `shell` job in proxy.yml runs that check and the lint target on every
proxy change. It runs there and not in `ci` because ci's `changes` filter
excludes proxy/**, so on a proxy-only PR the whole control-plane workflow
skips and a gate living only there would be silent exactly when it matters;
* //scripts:check_proxy_shell_lint puts the guard script itself under the
same aspect.
.gitattributes marks the symlinks `rules-lint-ignored` for the same reason
proxy/** already is: formatting one is formatting a proxy file by another
name, and shfmt refuses to write through a symlink at all, which failed
`make format` outright. It does not weaken the lint — that attribute is read
by the format multirun's `git ls-files` discovery, never by the aspect.
Proof the gate bites, not just that it runs: SC2045/SC2086 added to
proxy/bazel/image_metadata.sh (inside the ignored directory) fails
`bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...`
with exit 1, reported against the symlink path. Reverted. The coverage check
was proved the same way, in all three directions, and earned its keep on the
spot: rebasing onto #845 it failed on image_metadata.sh — a script that had
just landed with no symlink — and printed the exact `ln -s` that fixes it.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…tforms (#847) #845 put OCI provenance on every published image. For the rules_img ones it lands at index level and on each per-platform descriptor, so `crane manifest <index> | jq .annotations` answers directly. aether-proxy's index is assembled outside Bazel by `docker buildx imagetools create`, and carried no annotations at all — verified on the published artifact for the currently pinned tag, whose index JSON has no `annotations` key. The answer existed one hop down and the obvious query returned nothing, which is the same failure shape as #837 itself. The set is DERIVED from the two per-platform manifests rather than restated in the workflow. A literal list here would be a second source of truth for facts //proxy:image_metadata already owns, and would rot the first time that script gained or dropped a key — an index whose provenance disagrees with its platforms is worse than an index with none. Only keys present AND equal on both arches are promoted: an index annotation is a claim about the whole index, so a key that differs per platform stays where it is true. Everything aether sets is identical across arches by construction. The one non-derivation rule is that a foreign `org.opencontainers.image.source` is dropped. distroless/cc's manifest carries one pointing at GoogleContainerTools/distroless and rules_oci merges base annotations; promoting that would take #837's confidently-wrong answer and put it on the descriptor tools read first. Ordering, which is what could actually hurt: annotations CHANGE THE INDEX DIGEST, and bump-chart pins the chart to `index_digest`. They therefore go on the same `imagetools create` that publishes the index, and the read-back is unchanged and still last. There is deliberately no second annotate pass — that would republish a different index under the same tag and pin the chart to a digest nothing serves. Measured on a local registry: the same two sources give c94e979d... unannotated and ac04666f... annotated. The block can only ever ADD `--annotation` arguments. Unreadable manifests, a buildx without `--annotation` on `imagetools create` (caught by a `--dry-run` probe before anything is published), or a dry-run index missing a requested key each warn and fall back to the exact command that ran before this change. All four paths exercised against a real registry; the publish path is byte-identical to today's when the fallback triggers. Co-Authored-By: Claude Opus 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
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.
Two independent fixes, both split out of #845 and both small enough that neither wants its own review cycle.
Closes #847.
Closes #848.
1 — #847:
aether-proxy's multi-arch index carries no annotations#845 put OCI provenance on every published image. For the rules_img ones it lands at index level and on each per-platform descriptor, so the obvious query answers directly.
aether-proxy's index is assembled outside Bazel, bydocker buildx imagetools createinproxy-release.yml, and carried nothing.Confirmed on the published artifact rather than assumed — anonymous, read-only, the tag
charts/aether/values.yamlcurrently pins:No
annotationskey at all, and no descriptor annotations either. The per-platform manifest one hop down has exactly one —org.opencontainers.image.source = …/GoogleContainerTools/distroless, inherited from the base, which is the confidently-wrong answer #837 was about.The set is derived, not restated
The obvious implementation is a literal list of
--annotationflags in the workflow. That is a second source of truth for facts//proxy:image_metadataalready owns, and it rots the first time that script gains or drops a key — and an index whose provenance disagrees with its platforms is worse than an index with none, which is the thing #847 explicitly warns about.So the workflow reads the two per-platform manifests back and promotes what it finds:
with three rules:
argvelement); a newline would break the line-oriented hand-off;org.opencontainers.image.source. This is the one non-derivation rule.distroless/cccarries one and rules_oci merges base annotations; fix: OCI provenance labels on every published image (#837), and make kill -TERM stop the soak churn driver (#835) #845 overrides it, but promoting the inherited value would take Cannot determine which Envoy a running proxy contains: version gauge mismatches the pin and images carry no provenance labels #837's wrong answer and put it on the descriptor tools read first. A foreignsourceis dropped, leaving the honest absence the repo already had.Digest ordering — the thing that could actually hurt
Adding annotations changes the index digest, and
bump-chartpins the chart toindex_digest. Measured, not reasoned about — same two source manifests, local registry:sha256:c94e979d37f51c5a…sha256:ac04666f0f668c1e…So the annotations go on the same
imagetools createthat publishes the index, and the read-back below it is untouched and still the last thing that happens. There is deliberately no second "annotate afterwards" pass: that would republish a different index under the same tag and pin the chart to a digest nothing serves any more. The comment in the file says so, next to the read-back, in those words.Verified by fetching the published index by the digest the step emitted:
What a bad outcome would look like, and why this cannot cause one
This is a publishing workflow, so the failure that matters is "the release breaks", not "the build breaks". Three shapes:
bump-chartnever runs and the release silently does not pin.The whole block can only ever add
--annotationarguments to the create, and every path that cannot produce good ones falls back toannotate=()— at which point the command is byte-for-byte the one that ran before this change:inspectcalls are the condition of anif; if either fails, warn and publish unannotated;--dry-runbefore anything is published.--dry-runbuilds the index and prints it instead of pushing, so a buildx without--annotationonimagetools create, or one that silently drops a key, costs the annotations and not the release;(2) is structural: one create, annotations on it, read-back after it.
All four paths were exercised against a real local registry (
registry:2), running the step extracted verbatim from the YAML underbash -ewithIMAGE/RUNNER_TEMP/GITHUB_OUTPUT/GITHUB_STEP_SUMMARYset the way Actions sets them:source){}, exit 0base.digestaaaa/bbbb)imagetools inspectfailing (shimmed)--annotation(shimmed)The step body also passes shellcheck 0.11.0 clean once the
${{ }}templating is substituted.Not verifiable without a real release: that GHCR (rather than the local
registry:2) preserves index annotations throughimagetools create, and that the hosted runner's buildx accepts the flag — local buildx is v0.37.1,--annotationhas been onimagetools createfor many versions, and the dry-run probe is exactly the guard for being wrong about that. The first realproxy-releaserun will show the index annotations in its step summary, which this change adds.2 — #848: the proxy workspace's shell was linted by nothing
proxy/bazel/image_metadata.shand the twoproxy/integration/check_*.shwere not covered bymake lint.proxyis in//.bazelignore, so root tooling never descends into it.The ignore stays.
//proxyis a separate bzlmod workspace pinned to its own Bazel version whose//:imageis a multi-hour Envoy compile.What was chosen, and what was rejected
Chosen: a root-level shellcheck target listing the proxy scripts explicitly.
//bazel/lint/proxy_shellis ansh_libraryover source symlinks intoproxy/, which is how it gets past.bazelignore: a label under an ignored directory resolves but is never staged into a sandbox, whereas a symlink to it is an ordinary source file of the linting package. This is not a new trick in this repo —//website:staged/proxy-README.mdreachesproxy/README.mdthe same way, and//:website_docsdocuments why.sh_libraryspecifically, because that is the rule kindlint_shellcheck_aspectvisits. Nothing here touches the proxy build graph: four source files, no toolchain, no C++, no Envoy.The decisive advantage is that it answers the issue as written — the scripts are now covered by
make lint, the command a developer actually runs — and it is provable locally with the repo's own lint invocation.Rejected: lint wiring inside the proxy workspace. It would mean a new
bazel_deponaspect_rules_lintinproxy/MODULE.bazel, lockfile churn and a fresh download inside the workspace whose whole problem is that it is expensive, to lint four files. It also leavesmake lintstill not covering them, so the issue's own sentence stays true.Rejected: a plain shellcheck step in
proxy.yml. Cheapest to write, but it is a second, non-Bazel lint path with its own shellcheck version and its own config discovery, diverging from.shellcheckrcand//bazel/lint:linters.bzlthe moment either moves. And a developer runningmake lintbefore pushing would still not see the finding.Keeping it honest
A symlink list is only as good as its completeness: add
proxy/bazel/newthing.sh, forget the symlink, and it is silently unlinted again — the exact state #848 exists to end.scripts/check-proxy-shell-lint.shfails on any difference between the two sets, in either direction, and prints theln -sthat fixes it.That check earned its keep immediately. Rebasing this branch onto #845 the moment it merged:
— the script the issue is named after, caught on arrival.
CI placement, which is load-bearing
The gate runs in a new
shelljob inproxy.yml, not inci.ci'schangesfilter excludesproxy/**/!(*.md)outright, so on a proxy-only PR the entire control-plane workflow skips and a gate living only there would be silent in exactly the case it exists for.proxy.ymlis the workflow that fires on a proxy change. It is a separate job fromtestso it reports in seconds instead of behind the compile matrix, runs from the repository root, needs no RBE and no BuildBuddy key, and is wired into theproxyrequired check.Proof it is enforced, not advisory
A violation introduced into the real file inside the ignored directory:
Reverted. The coverage check was proved the same way in all three directions — a proxy script with no symlink, a stale symlink with no script, and a symlink replaced by a copy — each exits 1 with a specific message.
One incidental fix
.gitattributesmarks the symlinksrules-lint-ignored, for the same reasonproxy/**already is: formatting one is formatting a proxy file by another name, and shfmt refuses to write through a symlink at all (refusing to atomically replace … as it is not one already), which mademake formatfail rather than skip. It does not weaken the lint — that attribute is read by the format multirun'sgit ls-filesdiscovery, never by the aspect. Reaching these files with the linter and not the formatter is the intent.A finding this turned up, filed separately
The shellcheck aspect has been in
--config=lintall along, andbazel query 'kind("sh_(binary|library|test)", //...)'returned nothing — the root workspace declared nosh_*target at all, somake linthas never shellcheck'd a line of the repository's own shell either (scripts/,e2e/,bazel/). Three of those scripts have live SC2155/SC2034 findings, so fixing them is a change to test harnesses rather than build config, and not #848. Filed as #853;//scripts:check_proxy_shell_lint(added here so the guard script is itself linted) is the one-file precedent it can grow from.Verification
No
charts/change, so noChart.yamlbump. No Go change, so no Gazelle run. Therules_shellbazel_depis new (Bazel 9 no longer provides the nativesh_*rules) and pinned to 0.8.0, the versionproxy/MODULE.bazelalready uses;bazel mod tidymoved three lines ofMODULE.bazel.lock.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Co-Authored-By: Claude Opus 5 [email protected]
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr