Add --append-image-name-suffix to pack extension package#2630
Open
lcampanella98 wants to merge 1 commit into
Open
Add --append-image-name-suffix to pack extension package#2630lcampanella98 wants to merge 1 commit into
--append-image-name-suffix to pack extension package#2630lcampanella98 wants to merge 1 commit into
Conversation
Mirrors the existing buildpack package flag so multi-arch extensions can be published to registries that don't allow overwriting existing tags.
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.
Summary
pack buildpack packagesupports--append-image-name-suffix, butpack extension packagedoes not.When publishing a multi-arch extension with
--publish, pack builds one image per target platform and pushes them before assembling the final image index. Without a suffix, every platform image is pushed to the same tag. On a registry that doesn't allow overwriting an existing tag, the second platform's push is rejected and the publish fails.This adds
--append-image-name-suffixtopack extension package, mirroring the existing buildpack command. When the flag is set on a multi-arch--publish, each platform image is pushed to a distinct[os]-[arch]tag, so no two pushes collide. The final image index is unchanged and still resolves to all platforms. The suffix only applies when the build is multi-arch (len(targets) > 1) and--publishis set.The change reuses the shared
client.PackageBuildpackOptions(it already has theAppendImageNameSuffixfield), so it closely mirrors the buildpack code:buildpack_package.go#L33--publish—buildpack_package.go#L135-L137--publish) —buildpack_package.go#L145buildpack_package.go#L174package_buildpack.go#L204-L211I added unit tests covering that the flag is passed through when publishing and ignored (with a warning) when not. I did not add a client-level test for the suffix itself: the transformation it calls (
name.AppendSuffix) is already covered ininternal/name, and a multi-arch publish test would need significant new mocking the buildpack path doesn't have either. Happy to add one if preferred.Output
Publishing the samples
cowsayextension to two platforms:Before
Only the index tag is created. On a registry that blocks tag overwrites, the publish fails when the second platform pushes to the already-existing tag:
After
Each platform gets its own tag, so nothing is overwritten and the publish succeeds.
lateststill resolves to both platforms:I verified the failure and the fix against an immutable-tag registry (zot configured to allow creating tags but not overwriting them). The exact rejection text is registry-specific; in my zot setup it surfaced as
UNAUTHORIZED, while other registries phrase it as a tag-immutability error. The common behavior is that the second push to an existing tag is rejected.Documentation
Related
Resolves #2366