fix(bake): don't mangle temp image name for registries with a port - #766
Open
ianpittwood wants to merge 1 commit into
Open
fix(bake): don't mangle temp image name for registries with a port#766ianpittwood wants to merge 1 commit into
ianpittwood wants to merge 1 commit into
Conversation
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
Test Results2 246 tests 2 246 ✅ 9m 21s ⏱️ Results for commit 7450d73. |
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.
Problem
BakeTarget.from_image_target()stripped what it assumed was a tag off the temp image name withrsplit(":", 1)[0]. That split on the last:anywhere in the reference — including a registry port — so a--temp-registrywith a port produced garbage:The bake target got tagged
localhost, poisoning the resultingimage.namemetadata (and everythingbakery ci publishderives from it) while the build still succeeded silently.ImageTarget.temp_namereturns{temp_registry}/{image}/tmpwith no tag, so thersplitwas a no-op in every correct case — it could only ever do harm — and it made the bake strategy disagree withImageTarget.build(), which usestemp_nameverbatim.Fix
Drop the
rsplit; useimage_target.temp_namedirectly, matchingImageTarget.build().Tests
test_temp_registry_with_port_not_mangled—--temp-registry localhost:5000yields taglocalhost:5000/test-image/tmp.test_temp_name_matches_build_strategy— bake tag equalsImageTarget.temp_name, proving bake/build produce the sameimage.name.Fixes #738