Skip to content

Stamp img_pull images referenced by their alias labels - #304

Merged
abrisco merged 1 commit into
periareon:mainfrom
rdark:richard/pla-2603-img-pull-image-alias
Oct 24, 2026
Merged

abrisco merged 1 commit into
periareon:mainfrom
rdark:richard/pla-2603-img-pull-image-alias

Conversation

@rdark

@rdark rdark commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

img_pull gives each pulled image several labels. In every version, one of them is an alias named after the repository, so @base//:base (which the shorthand @base expands to) points at @base//:image. Up to 0.3.16, @base//:image is the image_import target itself. From 0.3.17, the target is @base//:image_import, and @base//:image and @base//:final are aliases of it.

Bazel resolves aliases before helm_package sees the target, so stamps are keyed only on the target's own label. On 0.3.17 and later that is @base//:image_import, and a values file using {@base//:image} fails with Failed to find key @@…//:image_import in content. On 0.3.9 the same values work, because image was the target itself, and {@base//:base} has never worked.

This PR adds the image's alias labels as extra stamp keys: :image, :final and :base from 0.3.17, and :base before that. The image is matched by any of them, and the missing-stamp error lists all of them. Aliases are added only for an image_import at the root of an external repository, which is where img_pull writes it.

It also bumps the dev dependency on rules_img from 0.3.9 to 0.3.18, so tests/with_image_deps_img exercises the alias case. That test now also checks :image_import, :final and the repository-name label.

Testing

  • bazel test //... and --config=strict on macOS with Bazel 9.3.0 and 7.7.1: 63 pass, 3 skipped. The skipped tests are tests/with_image_deps_img, which only run on Linux.
  • Built tests/with_image_deps_img for linux_arm64 and checked its values_patterns by hand: 11 of 11 match on 0.3.18 (Bazel 9.3.0 and 7.7.1). Without the alias change, the :image and repository-name patterns fail. On 0.3.9 the repository-name label now also stamps; the :image_import and :final labels do not exist there.
  • New Go unit test for the packager's stamp keys with aliases.
  • Not run: the Linux and Windows CI jobs themselves.

From rules_img 0.3.17, `img_pull` makes `:image` and `:final` aliases of
an `:image_import` target. Bazel resolves aliases before helm_package sees
the target, so stamps were keyed only on `:image_import` and values using
`{@repo//:image}` failed to build. The repository-name alias never stamped.

Add the alias labels `img_pull` defines as extra stamp keys, list them in
the missing-stamp error, and bump the rules_img dev dependency to 0.3.18 so
tests/with_image_deps_img covers the alias case.
@rdark
rdark marked this pull request as ready for review October 19, 2026 15:30

@abrisco abrisco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@abrisco
abrisco merged commit 55b66c4 into periareon:main Oct 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants