Skip to content

Support registry names with port numbers#2591

Open
ankit-songara wants to merge 8 commits intobuildpacks:mainfrom
ankit-songara:fix/registry-port
Open

Support registry names with port numbers#2591
ankit-songara wants to merge 8 commits intobuildpacks:mainfrom
ankit-songara:fix/registry-port

Conversation

@ankit-songara
Copy link
Copy Markdown

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]

@ankit-songara ankit-songara requested review from a team as code owners May 4, 2026 15:48
@github-actions github-actions Bot added this to the 0.41.0 milestone May 4, 2026
@github-actions github-actions Bot added the type/enhancement Issue that requests a new feature or improvement. label May 4, 2026
@ankit-songara ankit-songara force-pushed the fix/registry-port branch 2 times, most recently from e971e0a to 192882f Compare May 4, 2026 17:19
@github-actions github-actions Bot added the type/chore Issue that requests non-user facing changes. label May 4, 2026
Ankitsongara2003 and others added 6 commits May 5, 2026 18:42
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>
ankit-songara and others added 2 commits May 5, 2026 18:44
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/chore Issue that requests non-user facing changes. type/enhancement Issue that requests a new feature or improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

canBeRegistryRef returns falso on registry names with port numbers

2 participants