Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin_src/main' into image-spec/rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
qweeah committed Aug 9, 2023
2 parents 9e801c5 + ceb56f8 commit a2646a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/oras/root/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/spf13/cobra"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/registry"
"oras.land/oras/cmd/oras/internal/display"
"oras.land/oras/cmd/oras/internal/option"
)
Expand Down Expand Up @@ -58,6 +59,9 @@ Example - Tag the manifest 'v1.0.1' to 'v1.0.2' in an OCI image layout folder 'l
Args: cobra.MinimumNArgs(2),
PreRunE: func(cmd *cobra.Command, args []string) error {
opts.RawReference = args[0]
if _, err := registry.ParseReference(opts.RawReference); err != nil {
return fmt.Errorf("unable to add tag for '%s': %w", opts.RawReference, err)
}
opts.targetRefs = args[1:]
return option.Parse(&opts)
},
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/suite/command/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ var _ = Describe("ORAS beginners:", func() {
})

It("should fail when provided manifest reference is not found", func() {
ORAS("tag", RegistryRef(Host, ImageRepo, "i-dont-think-this-tag-exists")).ExpectFailure().MatchErrKeyWords("Error:").Exec()
ORAS("tag", RegistryRef(Host, ImageRepo, "i-dont-think-this-tag-exists"), "tagged").ExpectFailure().MatchErrKeyWords("Error:").Exec()
})

It("should fail when provided invalid reference", func() {
ORAS("tag", "list", "tagged").ExpectFailure().MatchErrKeyWords("Error:", "'list'").Exec()
})
})
})
Expand Down

0 comments on commit a2646a5

Please sign in to comment.