Support registry names with port numbers#2591
Open
ankit-songara wants to merge 8 commits intobuildpacks:mainfrom
Open
Support registry names with port numbers#2591ankit-songara wants to merge 8 commits intobuildpacks:mainfrom
ankit-songara wants to merge 8 commits intobuildpacks:mainfrom
Conversation
e971e0a to
192882f
Compare
Registry references with port numbers (e.g., localhost:5000/image:tag) were incorrectly rejected by the registryPattern regex, which only allowed [a-z0-9\-\.] characters before the slash. Update pattern to include colons: [a-z0-9\-\.:]+ This allows users to reference images in local Docker registries or private registries running on non-standard ports. Fixes buildpacks#2536 Signed-off-by: Ankit Songara <ankitsongara2003@gmail.com>
Fixes formatting issue causing verify-format check to fail. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Signed-off-by: Ankit Songara <ankitsongara2003@gmail.com>
…k test Update test to use docker:// prefix for image URIs containing port numbers, ensuring they are classified as PackageLocators instead of RegistryLocators. Also update mock expectations to use ParsePackageLocator to strip the prefix. Signed-off-by: Ankit Songara <ankitsongara2003@gmail.com>
Strip docker:// prefix using ParsePackageLocator before attempting to parse as a container image reference. This ensures URIs like docker://localhost:5000/image are correctly classified as PackageLocators instead of URILocators. Signed-off-by: Ankit Songara <ankitsongara2003@gmail.com>
Use strings.ToLower() when generating random buildpack image names to ensure they conform to the [a-z0-9\-.] pattern required by buildpack registry lookup. Prevents acceptance test failures when random strings contain uppercase letters. Signed-off-by: Ankit Songara <ankitsongara2003@gmail.com>
Add missing closing parentheses for ToLower function calls that wrap RandString in acceptance test buildpack name generation. Signed-off-by: Ankit Songara <ankitsongara2003@gmail.com>
68856cd to
6b795f8
Compare
Wrap RandString in strings.ToLower for multi-platform builder names and remote run/build images to prevent uppercase characters that violate registry name pattern requirements. Signed-off-by: Ankit Songara <ankitsongara2003@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.
Fixes #2536
Problem
Registry references with port numbers (e.g., localhost:5000/image:tag) were incorrectly rejected by the registryPattern regex.
Root Cause
The canBeRegistryRef() function uses a regex pattern that only allowed [a-z0-9-.] characters before the forward slash, excluding colons (:) needed for port numbers.
Solution
Updated registryPattern to include colons in character class: [a-z0-9-.:]+
This allows users to reference images in:- Local Docker registries (localhost:5000)- Private registries on non-standard ports- Other local registry scenarios
Testing
Pattern now correctly matches:- docker://localhost:5000/image:tag- registry.company.com:443/path/image- Any [scheme]://[registry]:[port]/[image]:[version]