oras
oras copied to clipboard
oras tag/push should fail fast on invalid input
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.
For oci-layout, tagging with digest won't even give an error.
Same for oras push
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