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
The bake target would then be tagged localhost, and the resulting metadata image.name
(and therefore BuildMetadata.image_ref, and therefore ImageTarget.get_merge_sources() and
everything bakery ci publish does with it) would be garbage — silently, since the build
itself would still succeed against a bogus name.
Two aggravating factors:
ImageTarget.temp_name (image_target.py:573-578) returns {temp_registry}/{image}/tmp
with no tag at all, so the rsplit is a no-op in every correct case — it can only ever
do harm.
ImageTarget.build() uses self.temp_name verbatim (image_target.py:678), so the two
build strategies disagree about how the temp name is derived. Keeping them identical is
what makes bake/build metadata provably interchangeable (see [SPIKE] investigate bake build metadata for native workflow migration #728).
Local registries with ports are a normal --temp-registry value for local/dev and bakery services style workflows, so this is reachable, not theoretical.
Fix
Drop the rsplit and use image_target.temp_name directly, matching ImageTarget.build().
If tag-stripping is ever genuinely needed, it must be done with a reference parser that
understands registry ports (split on the last : only when it appears after the final /).
Acceptance criteria
Bake targets for temp-registry builds are tagged with the same value ImageTarget.build()
uses.
Test with --temp-registry localhost:5000 asserting the bake plan target tag is localhost:5000/<image>/tmp.
Test asserting bake and build strategies produce the same image.name for a temp-registry
target.
Problem
BakeTarget.from_image_target()strips what it assumes is a tag off the temporary image name:rsplit(":", 1)[0]is not tag-aware — it splits on the last:anywhere in the reference,including a registry port. For a temp registry with a port:
The bake target would then be tagged
localhost, and the resulting metadataimage.name(and therefore
BuildMetadata.image_ref, and thereforeImageTarget.get_merge_sources()andeverything
bakery ci publishdoes with it) would be garbage — silently, since the builditself would still succeed against a bogus name.
Two aggravating factors:
ImageTarget.temp_name(image_target.py:573-578) returns{temp_registry}/{image}/tmpwith no tag at all, so the
rsplitis a no-op in every correct case — it can only everdo harm.
ImageTarget.build()usesself.temp_nameverbatim (image_target.py:678), so the twobuild strategies disagree about how the temp name is derived. Keeping them identical is
what makes bake/build metadata provably interchangeable (see [SPIKE] investigate bake build metadata for native workflow migration #728).
Local registries with ports are a normal
--temp-registryvalue for local/dev andbakery servicesstyle workflows, so this is reachable, not theoretical.Fix
Drop the
rsplitand useimage_target.temp_namedirectly, matchingImageTarget.build().If tag-stripping is ever genuinely needed, it must be done with a reference parser that
understands registry ports (split on the last
:only when it appears after the final/).Acceptance criteria
ImageTarget.build()uses.
--temp-registry localhost:5000asserting the bake plan target tag islocalhost:5000/<image>/tmp.image.namefor a temp-registrytarget.