Skip to content

fix: annotate the aether-proxy index (#847), and put the proxy workspace's shell under make lint (#848) - #854

Merged
bpalermo merged 2 commits into
mainfrom
fix/proxy-index-annotations-and-shell-lint
Sep 20, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/proxy-index-annotations-and-shell-lint

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

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, by docker buildx imagetools create in proxy-release.yml, and carried nothing.

Confirmed on the published artifact rather than assumed — anonymous, read-only, the tag charts/aether/values.yaml currently pins:

$ docker buildx imagetools inspect --raw ghcr.io/bpalermo/aether/aether-proxy:cff8beb…
{ "schemaVersion": 2, "mediaType": "…image.index.v1+json", "manifests": [ … ] }

No annotations key 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 --annotation flags in the workflow. That is a second source of truth for facts //proxy:image_metadata already 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:

docker buildx imagetools inspect --raw "${IMAGE}@${amd64}" > "$amd_json"
docker buildx imagetools inspect --raw "${IMAGE}@${arm64}" > "$arm_json"
jq -r -n --slurpfile a "$amd_json" --slurpfile b "$arm_json" --arg src "$SOURCE_URL" '…'

with three rules:

Digest ordering — the thing that could actually hurt

Adding annotations changes the index digest, and bump-chart pins the chart to index_digest. Measured, not reasoned about — same two source manifests, local registry:

index digest
unannotated sha256:c94e979d37f51c5a…
annotated sha256:ac04666f0f668c1e…

So the annotations go on the same imagetools create that 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:

$ docker buildx imagetools inspect --raw 127.0.0.1:5000/aether-proxy@sha256:ac04666f…
{"annotations":{"dev.aethermesh.envoy.bazel-registry":"bed06c78…",
                "dev.aethermesh.envoy.module-version":"1.40.0-dev.20260904.13144fb.envoy",
                "dev.aethermesh.envoy.revision":"13144fb",
                "org.opencontainers.image.revision":"0a017801…",
                "org.opencontainers.image.source":"https://github.com/bpalermo/aether"},
 "n":2}

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:

  1. the index is never published (the create fails), leaving two per-arch blobs in the registry with no manifest referencing them;
  2. the chart is pinned to a digest that does not exist, i.e. the annotate/read-back order gets inverted;
  3. the job fails after publishing, so bump-chart never runs and the release silently does not pin.

The whole block can only ever add --annotation arguments to the create, and every path that cannot produce good ones falls back to annotate=() — at which point the command is byte-for-byte the one that ran before this change:

  • the two inspect calls are the condition of an if; if either fails, warn and publish unannotated;
  • the argument list is proved with --dry-run before anything is published. --dry-run builds the index and prints it instead of pushing, so a buildx without --annotation on imagetools create, or one that silently drops a key, costs the annotations and not the release;
  • the post-publish check that the pinned digest carries the annotations is a warning, not a failure, precisely because failing there would cost the chart pin (shape 3) to report a missing convenience.

(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 under bash -e with IMAGE/RUNNER_TEMP/GITHUB_OUTPUT/GITHUB_STEP_SUMMARY set the way Actions sets them:

scenario result
post-#845 shape (5 keys, both arches) all 5 on the index, exit 0, digest read back
pre-#845 shape (only the inherited distroless source) dropped with a warning, index published with {}, exit 0
a key that differs per arch (base.digest aaaa/bbbb) that key withheld, the agreeing ones promoted, exit 0
imagetools inspect failing (shimmed) warning, unannotated publish, exit 0
buildx rejecting --annotation (shimmed) dry-run catches it, warning, unannotated publish, exit 0

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 through imagetools create, and that the hosted runner's buildx accepts the flag — local buildx is v0.37.1, --annotation has been on imagetools create for many versions, and the dry-run probe is exactly the guard for being wrong about that. The first real proxy-release run 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.sh and the two proxy/integration/check_*.sh were not covered by make lint. proxy is in //.bazelignore, so root tooling never descends into it.

The ignore stays. //proxy is a separate bzlmod workspace pinned to its own Bazel version whose //:image is 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_shell is an sh_library over source symlinks into proxy/, 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.md reaches proxy/README.md the same way, and //:website_docs documents why. sh_library specifically, because that is the rule kind lint_shellcheck_aspect visits. 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_dep on aspect_rules_lint in proxy/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 leaves make lint still 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 .shellcheckrc and //bazel/lint:linters.bzl the moment either moves. And a developer running make lint before 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.sh fails on any difference between the two sets, in either direction, and prints the ln -s that fixes it.

That check earned its keep immediately. Rebasing this branch onto #845 the moment it merged:

$ ./scripts/check-proxy-shell-lint.sh
uncovered: proxy/bazel/image_metadata.sh has no symlink at bazel/lint/proxy_shell/bazel/image_metadata.sh
           fix: mkdir -p bazel/lint/proxy_shell/bazel && ln -s ../../../../proxy/bazel/image_metadata.sh bazel/lint/proxy_shell/bazel/image_metadata.sh

— the script the issue is named after, caught on arrival.

CI placement, which is load-bearing

The gate runs in a new shell job in proxy.yml, not in ci. ci's changes filter excludes proxy/**/!(*.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.yml is the workflow that fires on a proxy change. It is a separate job from test so 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 the proxy required check.

Proof it is enforced, not advisory

A violation introduced into the real file inside the ignored directory:

$ printf '\nfor f in $(ls); do echo $f; done\n' >> proxy/bazel/image_metadata.sh
$ bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...
ERROR: bazel/lint/proxy_shell/BUILD.bazel:37:11: Linting //bazel/lint/proxy_shell:proxy_shell with ShellCheck failed: (Exit 1)
  ^---^ SC2045 (error): Iterating over ls output is fragile. Use globs.
         ^-- SC2086 (info): Double quote to prevent globbing and word splitting.
ERROR: Build did NOT complete successfully
$ echo $?
1

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

.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 (refusing to atomically replace … as it is not one already), which made make format fail rather than skip. It does not weaken the lint — that attribute is read by the format multirun's git ls-files discovery, 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=lint all along, and bazel query 'kind("sh_(binary|library|test)", //...)' returned nothing — the root workspace declared no sh_* target at all, so make lint has 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

bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...   # 394 targets, exit 0
make format-check                                                              # clean
./scripts/check-proxy-shell-lint.sh                                            # OK: all 4 mirrored
bazel query 'kind("sh_(binary|library|test)", //...)'                          # the 2 new targets

No charts/ change, so no Chart.yaml bump. No Go change, so no Gazelle run. The rules_shell bazel_dep is new (Bazel 9 no longer provides the native sh_* rules) and pinned to 0.8.0, the version proxy/MODULE.bazel already uses; bazel mod tidy moved three lines of MODULE.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

bpalermo and others added 2 commits September 20, 2026 09:05
`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
@bpalermo
bpalermo merged commit 6323daf into main Sep 20, 2026
22 checks passed
@bpalermo
bpalermo deleted the fix/proxy-index-annotations-and-shell-lint branch September 20, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant