fix(buildpack): allow port numbers in registry reference URIs#2625
Open
AruneshDwivedi wants to merge 3 commits into
Open
fix(buildpack): allow port numbers in registry reference URIs#2625AruneshDwivedi wants to merge 3 commits into
AruneshDwivedi wants to merge 3 commits into
Conversation
The canBeRegistryRef regex pattern didn't allow port numbers in registry hostnames (e.g., localhost:5000/foo/bar). Added optional :\d+ to the host portion of the pattern. Fixes buildpacks#2536 Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com> Assisted-by: OWL Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
81283f0 to
d644f32
Compare
The canBeRegistryRef regex pattern didn't allow port numbers in registry hostnames (e.g., localhost:5000/foo/bar). Added optional :\d+ to the host portion of the pattern. Also updated the namespace validation in registry index to allow ':' characters for port numbers, while keeping name validation strict. Fixes buildpacks#2536 Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com> Assisted-by: OWL Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
…ferences When a Docker image reference like 'docker://localhost:5000/foo/bar' is passed to GetLocatorType, the code was calling name.ParseReference with the full URI including the docker:// prefix. The go-containerregistry library doesn't understand the docker:// prefix — it expects just the image name like 'localhost:5000/foo/bar'. Fix: Call ParsePackageLocator to strip the docker:// prefix before passing to name.ParseReference. Fixes buildpacks#2536 Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com> Assisted-by: OWL Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
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
Fixes #2536. The
canBeRegistryRefregex pattern didn't allow port numbers in registry hostnames. URIs likedocker://localhost:5000/foo/barwere incorrectly rejected.Root Cause
The
registryPatternregex atpkg/buildpack/locator_type.go:39didn't include an optional port component after the hostname.Fix
Added
(?::\\d+)?to the host portion of the regex pattern to allow optional port numbers.Testing
The pattern now matches registry references with port numbers (e.g.,
localhost:5000/foo/bar) in addition to existing patterns without ports.