Skip to content

fix(bake): don't mangle temp image name for registries with a port - #766

Open
ianpittwood wants to merge 1 commit into
mainfrom
fix/738-temp-name-registry-port
Open

fix(bake): don't mangle temp image name for registries with a port#766
ianpittwood wants to merge 1 commit into
mainfrom
fix/738-temp-name-registry-port

Conversation

@ianpittwood

Copy link
Copy Markdown
Contributor

Problem

BakeTarget.from_image_target() stripped what it assumed was a tag off the temp image name with rsplit(":", 1)[0]. That split on the last : anywhere in the reference — including a registry port — so a --temp-registry with a port produced garbage:

"localhost:5000/package-manager/tmp".rsplit(":", 1)[0] == "localhost"

The bake target got tagged localhost, poisoning the resulting image.name metadata (and everything bakery ci publish derives from it) while the build still succeeded silently.

ImageTarget.temp_name returns {temp_registry}/{image}/tmp with no tag, so the rsplit was a no-op in every correct case — it could only ever do harm — and it made the bake strategy disagree with ImageTarget.build(), which uses temp_name verbatim.

Fix

Drop the rsplit; use image_target.temp_name directly, matching ImageTarget.build().

Tests

  • test_temp_registry_with_port_not_mangled--temp-registry localhost:5000 yields tag localhost:5000/test-image/tmp.
  • test_temp_name_matches_build_strategy — bake tag equals ImageTarget.temp_name, proving bake/build produce the same image.name.

Fixes #738

rsplit(":", 1)[0] split on the last colon anywhere in the reference,
including a registry port, so a --temp-registry with a port (e.g.
localhost:5000) mangled the bake target tag down to the registry host.
temp_name carries no tag, so the rsplit was a no-op in every correct
case and only ever caused harm. Drop it and use temp_name directly,
matching ImageTarget.build().

Fixes #738
@github-actions

Copy link
Copy Markdown

Test Results

2 246 tests   2 246 ✅  9m 21s ⏱️
    1 suites      0 💤
    1 files        0 ❌

Results for commit 7450d73.

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.

Bake temp image name mangled by rsplit(":", 1) for registries containing a port

1 participant