[deckhouse-cli] Fix misleading error message for registry path#405
Open
Glitchy-Sheep wants to merge 1 commit into
Open
[deckhouse-cli] Fix misleading error message for registry path#405Glitchy-Sheep wants to merge 1 commit into
Glitchy-Sheep wants to merge 1 commit into
Conversation
- `d8 mirror push` and `pull --source` now explain what is missing: expected format `registry-host[:port]/path` plus an example built from the user's own input. - Without a path, `name.NewRepository` validates the whole `host:port` as a repository name and blames the `:`, so users read the error as "ports are not allowed". - Remaining parse errors name the argument (`<registry>`, `--source`) so it is clear which input is bad. - Tests pin the new messages and keep currently-valid addresses accepted (`myregistry/repo`, `localhost:5000//repo`, IP with port). Signed-off-by: Roman Berezkin <roman.berezkin@flant.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
Pushing to a registry root (e.g.
localhost:5000) failed with a raw go-containerregistry error about invalid characters. Users read it as "the port is not allowed". Now the CLI says what is actually missing: the repository path.Problem
d8 mirror push distr/ localhost:5000 --insecurefails with:Validate registry address: repository can only contain the characters 'abcdefghijklmnopqrstuvwxyz0123456789_-./': localhost:5000localhost:5000/deckhouse). Pushing to a registry root is not supported.:before the port./in the address,name.NewRepositoryvalidates the wholehost:portstring as a repository name, where:is illegal. The friendlier host and path checks below never run.Fix
name.NewRepository.mirror push <registry>andmirror pull --source.Validate registry address:wrapper.--sourceflag help.Before / After
Before:
After:
Tests
TestParseAndValidateRegistryURLArg(push): new cases forlocalhost:5000,http://scheme stripping, trailing slash, and the full new message text.192.168.1.1:5000/repo,myregistry/repo,localhost:5000//repo- they stay accepted.TestValidationValidateSourceRegistry(pull): new cases forlocalhost:5000and trailing slash; the existing "no path" case now asserts the new message.