Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oras tag/push should fail fast on invalid input #1479

Open
wangxiaoxuan273 opened this issue Aug 15, 2024 · 1 comment
Open

oras tag/push should fail fast on invalid input #1479

wangxiaoxuan273 opened this issue Aug 15, 2024 · 1 comment
Labels
ux User experience related
Milestone

Comments

@wangxiaoxuan273
Copy link
Contributor

wangxiaoxuan273 commented Aug 15, 2024

Many oras commands require tag or digest input from the user, but in some cases validation is missing. And if invalid tags or digest is given, errors will be returned from remote registry server.

For example:
oras tag does not validate if the given tag is valid. If given a digest, the operation will not fail until reaching the remote registry.
image

For oci-layout, tagging with digest won't even give an error.
image

Same for oras push
image

image

We could instead validate the tags/digests during command parsing, and fail fast if invalid input is found. oras-go contains the following methods that can be incorporated into func (opts *Target) Parse(cmd *cobra.Command) error of oras.

func (r Reference) ValidateReference() error
func (r Reference) ValidateReferenceAsDigest() error
func (r Reference) ValidateReferenceAsTag() error

@qweeah qweeah added the ux User experience related label Aug 16, 2024
@qweeah qweeah added this to the future milestone Aug 16, 2024
@qweeah qweeah added the triage New issues or PRs to be acknowledged by maintainers label Aug 16, 2024
@qweeah qweeah removed the triage New issues or PRs to be acknowledged by maintainers label Aug 27, 2024
@qweeah
Copy link
Contributor

qweeah commented Aug 27, 2024

Some registries might allow tag names that will fail in https://pkg.go.dev/oras.land/oras-go/[email protected]/registry#Reference.ValidateReferenceAsTag. So to make ORAS CLI be able to consume those tags, it's better to only exclude digests.

@shizhMSFT shizhMSFT changed the title oras should validate tag/digest input during command parsing stage oras tag/push should fail fast on invalid input Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User experience related
Projects
None yet
Development

No branches or pull requests

2 participants