oras icon indicating copy to clipboard operation
oras copied to clipboard

oras tag/push should fail fast on invalid input

Open wangxiaoxuan273 opened this issue 6 months ago • 1 comments

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

wangxiaoxuan273 avatar Aug 15 '24 03:08 wangxiaoxuan273