diff --git a/cmd/oras/root/attach.go b/cmd/oras/root/attach.go index 90508a2f4..e270d024c 100644 --- a/cmd/oras/root/attach.go +++ b/cmd/oras/root/attach.go @@ -44,7 +44,8 @@ type attachOptions struct { artifactType string concurrency int - verbose bool + // Deprecated: verbose is deprecated and will be removed in the future. + verbose bool } func attachCmd() *cobra.Command { @@ -117,9 +118,10 @@ Example - Attach file to the manifest tagged 'v1' in an OCI image layout folder cmd.Flags().StringVarP(&opts.artifactType, "artifact-type", "", "", "artifact type") cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 5, "concurrency level") - cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "print status output for unnamed blobs") + cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", true, "print status output for unnamed blobs") opts.FlagDescription = "[Preview] attach to an arch-specific subject" _ = cmd.MarkFlagRequired("artifact-type") + _ = cmd.Flags().MarkDeprecated("verbose", "and will be removed in a future release.") opts.EnableDistributionSpecFlag() opts.SetTypes(option.FormatTypeText, option.FormatTypeJSON, option.FormatTypeGoTemplate) option.ApplyFlags(&opts, cmd.Flags()) diff --git a/cmd/oras/root/blob/push.go b/cmd/oras/root/blob/push.go index 9dbc80b34..883de2fe5 100644 --- a/cmd/oras/root/blob/push.go +++ b/cmd/oras/root/blob/push.go @@ -42,7 +42,8 @@ type pushBlobOptions struct { fileRef string mediaType string size int64 - verbose bool + // Deprecated: verbose is deprecated and will be removed in the future. + verbose bool } func pushCmd() *cobra.Command { @@ -98,7 +99,8 @@ Example - Push blob 'hi.txt' into an OCI image layout folder 'layout-dir': cmd.Flags().Int64VarP(&opts.size, "size", "", -1, "provide the blob size") cmd.Flags().StringVarP(&opts.mediaType, "media-type", "", ocispec.MediaTypeImageLayer, "specify the returned media type in the descriptor if --descriptor is used") - cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "print status output for unnamed blobs") + cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", true, "print status output for unnamed blobs") + _ = cmd.Flags().MarkDeprecated("verbose", "and will be removed in a future release.") option.ApplyFlags(&opts, cmd.Flags()) return oerrors.Command(cmd, &opts.Target) } diff --git a/cmd/oras/root/cp.go b/cmd/oras/root/cp.go index 6e9a06d6c..c6693edcb 100644 --- a/cmd/oras/root/cp.go +++ b/cmd/oras/root/cp.go @@ -50,7 +50,8 @@ type copyOptions struct { recursive bool concurrency int extraRefs []string - verbose bool + // Deprecated: verbose is deprecated and will be removed in the future. + verbose bool } func copyCmd() *cobra.Command { @@ -104,7 +105,8 @@ Example - Copy an artifact with multiple tags with concurrency tuned: } cmd.Flags().BoolVarP(&opts.recursive, "recursive", "r", false, "[Preview] recursively copy the artifact and its referrer artifacts") cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 3, "concurrency level") - cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "print status output for unnamed blobs") + cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", true, "print status output for unnamed blobs") + _ = cmd.Flags().MarkDeprecated("verbose", "and will be removed in a future release.") opts.EnableDistributionSpecFlag() option.ApplyFlags(&opts, cmd.Flags()) return oerrors.Command(cmd, &opts.BinaryTarget) diff --git a/cmd/oras/root/manifest/push.go b/cmd/oras/root/manifest/push.go index 2de0d5348..7fea60046 100644 --- a/cmd/oras/root/manifest/push.go +++ b/cmd/oras/root/manifest/push.go @@ -48,7 +48,8 @@ type pushOptions struct { extraRefs []string fileRef string mediaType string - verbose bool + // Deprecated: verbose is deprecated and will be removed in the future. + verbose bool } func pushCmd() *cobra.Command { @@ -109,7 +110,8 @@ Example - Push a manifest to an OCI image layout folder 'layout-dir' and tag wit option.ApplyFlags(&opts, cmd.Flags()) cmd.Flags().StringVarP(&opts.mediaType, "media-type", "", "", "media type of manifest") cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 5, "concurrency level") - cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "print status output for unnamed blobs") + cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", true, "print status output for unnamed blobs") + _ = cmd.Flags().MarkDeprecated("verbose", "and will be removed in a future release.") return oerrors.Command(cmd, &opts.Target) } diff --git a/cmd/oras/root/pull.go b/cmd/oras/root/pull.go index 10bccb060..e7b558fc3 100644 --- a/cmd/oras/root/pull.go +++ b/cmd/oras/root/pull.go @@ -52,7 +52,8 @@ type pullOptions struct { PathTraversal bool Output string ManifestConfigRef string - verbose bool + // Deprecated: verbose is deprecated and will be removed in the future. + verbose bool } func pullCmd() *cobra.Command { @@ -113,7 +114,8 @@ Example - Pull artifact files from an OCI layout archive 'layout.tar': cmd.Flags().StringVarP(&opts.Output, "output", "o", ".", "output directory") cmd.Flags().StringVarP(&opts.ManifestConfigRef, "config", "", "", "output manifest config file") cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 3, "concurrency level") - cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "print status output for unnamed blobs") + cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", true, "print status output for unnamed blobs") + _ = cmd.Flags().MarkDeprecated("verbose", "and will be removed in a future release.") opts.SetTypes(option.FormatTypeText, option.FormatTypeJSON, option.FormatTypeGoTemplate) option.ApplyFlags(&opts, cmd.Flags()) return oerrors.Command(cmd, &opts.Target) diff --git a/cmd/oras/root/push.go b/cmd/oras/root/push.go index b75c8661b..bc47c4fd4 100644 --- a/cmd/oras/root/push.go +++ b/cmd/oras/root/push.go @@ -52,7 +52,8 @@ type pushOptions struct { manifestConfigRef string artifactType string concurrency int - verbose bool + // Deprecated: verbose is deprecated and will be removed in the future. + verbose bool } func pushCmd() *cobra.Command { @@ -165,7 +166,8 @@ Example - Push file "hi.txt" into an OCI image layout folder 'layout-dir' with t cmd.Flags().StringVarP(&opts.manifestConfigRef, "config", "", "", "`path` of image config file") cmd.Flags().StringVarP(&opts.artifactType, "artifact-type", "", "", "artifact type") cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 5, "concurrency level") - cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", false, "print status output for unnamed blobs") + cmd.Flags().BoolVarP(&opts.verbose, "verbose", "v", true, "print status output for unnamed blobs") + _ = cmd.Flags().MarkDeprecated("verbose", "and will be removed in a future release.") opts.SetTypes(option.FormatTypeText, option.FormatTypeJSON, option.FormatTypeGoTemplate) option.ApplyFlags(&opts, cmd.Flags()) return oerrors.Command(cmd, &opts.Target) diff --git a/test/e2e/internal/testdata/feature/feature.go b/test/e2e/internal/testdata/feature/feature.go index 3bb065346..90d7426d1 100644 --- a/test/e2e/internal/testdata/feature/feature.go +++ b/test/e2e/internal/testdata/feature/feature.go @@ -15,6 +15,8 @@ limitations under the License. package feature +const DeprecationMessageVerboseFlag = "Flag --verbose has been deprecated, and will be removed in a future release." + var ( Preview = struct { Mark string diff --git a/test/e2e/internal/utils/match/status.go b/test/e2e/internal/utils/match/status.go index c35ae0e1f..b83df4660 100644 --- a/test/e2e/internal/utils/match/status.go +++ b/test/e2e/internal/utils/match/status.go @@ -77,6 +77,11 @@ func newStateMachine(cmd string) *stateMachine { sm.addPath("Skipped") sm.addPath("Exists") sm.addPath("Mounted") + case "manifest", "blob": // for `manifest push` and `blob push` + // TODO: refactor the matcher to match full command like `manifest push`, `manifest delete`, etc. + // Tracking issue: https://github.com/oras-project/oras/issues/1571 + sm.addPath("Uploading", "Uploaded") + sm.addPath("Exists") default: ginkgo.Fail("Unrecognized cmd name " + cmd) } diff --git a/test/e2e/suite/auth/auth.go b/test/e2e/suite/auth/auth.go index 8e82b7937..98d017fda 100644 --- a/test/e2e/suite/auth/auth.go +++ b/test/e2e/suite/auth/auth.go @@ -179,7 +179,7 @@ var _ = Describe("Common registry user", func() { src := RegistryRef(ZOTHost, ArtifactRepo, foobar.Tag) dst := RegistryRef(ZOTHost, fmt.Sprintf("command/auth/%d/copy", GinkgoRandomSeed()), foobar.Tag) foobarStates := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageConfigStateKey(oras.MediaTypeUnknownConfig)) - ORAS("cp", src, dst, "-v", "--from-registry-config", LegacyConfigPath, "--to-registry-config", LegacyConfigPath).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst, "--from-registry-config", LegacyConfigPath, "--to-registry-config", LegacyConfigPath).MatchStatus(foobarStates, true, len(foobarStates)).Exec() }) }) }) diff --git a/test/e2e/suite/command/attach.go b/test/e2e/suite/command/attach.go index f0c6ada5b..509615919 100644 --- a/test/e2e/suite/command/attach.go +++ b/test/e2e/suite/command/attach.go @@ -41,10 +41,41 @@ var _ = Describe("ORAS beginners:", func() { RunAndShowPreviewInHelp([]string{"attach"}) It("should show preview and help doc", func() { - out := ORAS("attach", "--help").MatchKeyWords(feature.Preview.Mark+" Attach", feature.Preview.Description, ExampleDesc).Exec() + out := ORAS("attach", "--help").MatchKeyWords(feature.Preview.Mark+" Attach", feature.Preview.Description, ExampleDesc).Exec().Out gomega.Expect(out).Should(gbytes.Say("--distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) + It("should not show --verbose in help doc", func() { + out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("--verbose")) + }) + + It("should show deprecation message and print unnamed status output for --verbose", func() { + testRepo := attachTestRepo("test-verbose") + CopyZOTRepo(ImageRepo, testRepo) + subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) + stateKeys := []match.StateKey{ + foobar.AttachFileStateKey, + {Digest: "44136fa355b3", Name: "application/vnd.oci.empty.v1+json"}, + } + ORAS("attach", "--artifact-type", "test/attach", "--verbose", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia)). + WithWorkDir(PrepareTempFiles()). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(stateKeys, true, len(stateKeys)).Exec() + }) + + It("should show deprecation message and should NOT print unnamed status output for --verbose=false", func() { + testRepo := attachTestRepo("test-verbose-false") + CopyZOTRepo(ImageRepo, testRepo) + subjectRef := RegistryRef(ZOTHost, testRepo, foobar.Tag) + stateKeys := []match.StateKey{foobar.AttachFileStateKey} + out := ORAS("attach", "--artifact-type", "test/attach", "--verbose=false", subjectRef, fmt.Sprintf("%s:%s", foobar.AttachFileName, foobar.AttachFileMedia)). + WithWorkDir(PrepareTempFiles()). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(stateKeys, false, len(stateKeys)).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.empty.v1+json")) + }) + It("should show text as default format type in help doc", func() { MatchDefaultFlagValue("format", "text", "attach") }) diff --git a/test/e2e/suite/command/blob.go b/test/e2e/suite/command/blob.go index 717a7d366..8d6ddf21d 100644 --- a/test/e2e/suite/command/blob.go +++ b/test/e2e/suite/command/blob.go @@ -24,8 +24,10 @@ import ( . "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" + "oras.land/oras/test/e2e/internal/testdata/feature" "oras.land/oras/test/e2e/internal/testdata/foobar" . "oras.land/oras/test/e2e/internal/utils" + "oras.land/oras/test/e2e/internal/utils/match" ) const ( @@ -39,6 +41,30 @@ var _ = Describe("ORAS beginners:", func() { repoFmt := fmt.Sprintf("command/blob/%%s/%d/%%s", GinkgoRandomSeed()) When("running blob command", func() { When("running `blob push`", func() { + It("should not show --verbose in help doc", func() { + out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("--verbose")) + }) + + It("should show deprecation message and print unnamed status output for --verbose", func() { + repo := fmt.Sprintf(repoFmt, "push", "test-verbose") + ORAS("blob", "push", RegistryRef(ZOTHost, repo, pushDigest), "-", "--size", strconv.Itoa(len(pushContent)), "--verbose"). + WithInput(strings.NewReader(pushContent)). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus([]match.StateKey{{Digest: "e1ca41574914", Name: "application/vnd.oci.image.layer.v1.tar"}}, true, 1). + Exec() + }) + + It("should show deprecation message and should NOT print unnamed status output for --verbose=false", func() { + repo := fmt.Sprintf(repoFmt, "push", "test-verbose-false") + out := ORAS("blob", "push", RegistryRef(ZOTHost, repo, pushDigest), "-", "--size", strconv.Itoa(len(pushContent)), "--verbose=false"). + WithInput(strings.NewReader(pushContent)). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + Exec().Out + // should not print status output for unnamed blobs + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.image.layer.v1.tar")) + }) + It("should fail to read blob content and password from stdin at the same time", func() { repo := fmt.Sprintf(repoFmt, "push", "password-stdin") ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), "--password-stdin", "-"). @@ -236,9 +262,11 @@ var _ = Describe("1.1 registry users:", func() { MatchContent(fmt.Sprintf(pushDescFmt, mediaType)).Exec() ORAS("blob", "fetch", RegistryRef(ZOTHost, repo, pushDigest), "--output", "-").MatchContent(pushContent).Exec() - ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), blobPath, "-v"). + ORAS("blob", "push", RegistryRef(ZOTHost, repo, ""), blobPath). WithDescription("skip the pushing if the blob already exists in the target repo"). - MatchKeyWords("Exists").Exec() + MatchStatus([]match.StateKey{{Digest: "e1ca41574914", Name: "application/vnd.oci.image.layer.v1.tar"}}, true, 1). + MatchKeyWords("Exists"). + Exec() }) It("should push a blob from a stdin and output the descriptor with specific media-type", func() { @@ -347,7 +375,7 @@ var _ = Describe("OCI image layout users:", func() { // test ORAS("blob", "push", Flags.Layout, LayoutRef(tmpRoot, pushDigest), blobPath, "--media-type", mediaType, "--descriptor"). MatchContent(fmt.Sprintf(pushDescFmt, mediaType)).Exec() - ORAS("blob", "push", Flags.Layout, LayoutRef(tmpRoot, pushDigest), blobPath, "-v"). + ORAS("blob", "push", Flags.Layout, LayoutRef(tmpRoot, pushDigest), blobPath). WithDescription("skip pushing if the blob already exists in the target repo"). MatchKeyWords("Exists").Exec() // validate diff --git a/test/e2e/suite/command/cp.go b/test/e2e/suite/command/cp.go index 70b278f64..169629c2a 100644 --- a/test/e2e/suite/command/cp.go +++ b/test/e2e/suite/command/cp.go @@ -22,6 +22,7 @@ import ( "strings" . "github.com/onsi/ginkgo/v2" + "github.com/onsi/gomega" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" ocispec "github.com/opencontainers/image-spec/specs-go/v1" @@ -33,6 +34,7 @@ import ( "oras.land/oras/test/e2e/internal/testdata/foobar" ma "oras.land/oras/test/e2e/internal/testdata/multi_arch" . "oras.land/oras/test/e2e/internal/utils" + "oras.land/oras/test/e2e/internal/utils/match" ) func cpTestRepo(text string) string { @@ -48,6 +50,37 @@ var _ = Describe("ORAS beginners:", func() { Expect(out).Should(gbytes.Say("--to-distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) + It("should not show --verbose in help doc", func() { + out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("--verbose")) + }) + + It("should show deprecation message and print unnamed status output for --verbose", func() { + src := RegistryRef(ZOTHost, ArtifactRepo, blob.Tag) + dst := RegistryRef(ZOTHost, cpTestRepo("test-verbose"), "copied") + ORAS("cp", src, dst, "--verbose"). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(blob.StateKeys, true, len(blob.StateKeys)). + Exec() + CompareRef(src, dst) + }) + + It("should show deprecation message and should NOT print unnamed status output for --verbose=false", func() { + src := RegistryRef(ZOTHost, ArtifactRepo, blob.Tag) + dst := RegistryRef(ZOTHost, cpTestRepo("test-verbose-false"), "copied") + stateKeys := []match.StateKey{ + {Digest: "2ef548696ac7", Name: "hello.tar"}, + } + out := ORAS("cp", src, dst, "--verbose=false"). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(stateKeys, false, len(stateKeys)). + Exec().Out + CompareRef(src, dst) + // should not print status output for unnamed blobs + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.empty.v1+json")) + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.image.manifest.v1+json")) + }) + It("should fail when no reference provided", func() { ORAS("cp").ExpectFailure().MatchErrKeyWords("Error:").Exec() }) @@ -121,7 +154,7 @@ var _ = Describe("1.1 registry users:", func() { It("should copy an artifact with blob", func() { src := RegistryRef(ZOTHost, ArtifactRepo, blob.Tag) dst := RegistryRef(ZOTHost, cpTestRepo("artifact-with-blob"), "copied") - ORAS("cp", src, dst, "-v").MatchStatus(blob.StateKeys, true, len(blob.StateKeys)).Exec() + ORAS("cp", src, dst).MatchStatus(blob.StateKeys, true, len(blob.StateKeys)).Exec() CompareRef(src, dst) }) @@ -137,34 +170,34 @@ var _ = Describe("1.1 registry users:", func() { It("should copy an artifact with config", func() { src := RegistryRef(ZOTHost, ArtifactRepo, config.Tag) dst := RegistryRef(ZOTHost, cpTestRepo("artifact-with-config"), "copied") - ORAS("cp", src, dst, "-v").MatchStatus(config.StateKeys, true, len(config.StateKeys)).Exec() + ORAS("cp", src, dst).MatchStatus(config.StateKeys, true, len(config.StateKeys)).Exec() }) It("should copy index and its subject", func() { stateKeys := append(ma.IndexStateKeys, index.ManifestStatusKey) src := RegistryRef(ZOTHost, ArtifactRepo, index.ManifestDigest) dst := RegistryRef(ZOTHost, cpTestRepo("index-with-subject"), "") - ORAS("cp", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", src, dst).MatchStatus(stateKeys, true, len(stateKeys)).Exec() }) It("should copy an image to a new repository via tag", func() { src := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) dst := RegistryRef(ZOTHost, cpTestRepo("tag"), "copied") - ORAS("cp", src, dst, "-v").MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst).MatchStatus(foobarStates, true, len(foobarStates)).Exec() CompareRef(src, dst) }) It("should copy an image to a new repository via digest", func() { src := RegistryRef(ZOTHost, ImageRepo, foobar.Digest) dst := RegistryRef(ZOTHost, cpTestRepo("digest"), "copiedTag") - ORAS("cp", src, dst, "-v").MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst).MatchStatus(foobarStates, true, len(foobarStates)).Exec() CompareRef(src, dst) }) It("should copy an image to a new repository via tag without tagging", func() { src := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) dst := RegistryRef(ZOTHost, cpTestRepo("no-tagging"), foobar.Digest) - ORAS("cp", src, dst, "-v").MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst).MatchStatus(foobarStates, true, len(foobarStates)).Exec() CompareRef(src, dst) }) @@ -172,7 +205,7 @@ var _ = Describe("1.1 registry users:", func() { stateKeys := append(append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageReferrerConfigStateKeys[0]), foobar.ImageReferrersStateKeys...) src := RegistryRef(ZOTHost, ArtifactRepo, foobar.Tag) dst := RegistryRef(ZOTHost, cpTestRepo("referrers"), foobar.Digest) - ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, dst).MatchStatus(stateKeys, true, len(stateKeys)).Exec() CompareRef(src, dst) }) @@ -181,7 +214,7 @@ var _ = Describe("1.1 registry users:", func() { src := RegistryRef(ZOTHost, ArtifactRepo, ma.Tag) dstRepo := cpTestRepo("index-referrers") dst := RegistryRef(ZOTHost, dstRepo, "copiedTag") - ORAS("cp", src, dst, "-r", "-v"). + ORAS("cp", src, dst, "-r"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.Digest). Exec() @@ -200,7 +233,7 @@ var _ = Describe("1.1 registry users:", func() { dstRepo := cpTestRepo("index-referrers-concurrent") dst := RegistryRef(ZOTHost, dstRepo, "copiedTag") // test - ORAS("cp", src, dst, "-r", "-v", "--concurrency", "0"). + ORAS("cp", src, dst, "-r", "--concurrency", "0"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.Digest). Exec() @@ -217,7 +250,7 @@ var _ = Describe("1.1 registry users:", func() { dstRepo := cpTestRepo("empty-index") dst := RegistryRef(ZOTHost, dstRepo, "copiedTag") // test - ORAS("cp", src, dst, "-r", "-v", "--concurrency", "0").Exec() + ORAS("cp", src, dst, "-r", "--concurrency", "0").Exec() // validate CompareRef(RegistryRef(ZOTHost, ImageRepo, ma.EmptyTag), dst) }) @@ -227,7 +260,7 @@ var _ = Describe("1.1 registry users:", func() { src := RegistryRef(ZOTHost, ArtifactRepo, ma.Tag) dstRepo := cpTestRepo("index-referrers-digest") dst := RegistryRef(ZOTHost, dstRepo, ma.Digest) - ORAS("cp", src, dst, "-r", "-v"). + ORAS("cp", src, dst, "-r"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.Digest). Exec() @@ -243,7 +276,7 @@ var _ = Describe("1.1 registry users:", func() { src := RegistryRef(ZOTHost, ImageRepo, ma.Tag) dst := RegistryRef(ZOTHost, cpTestRepo("platform-tag"), "copiedTag") - ORAS("cp", src, dst, "--platform", "linux/amd64", "-v"). + ORAS("cp", src, dst, "--platform", "linux/amd64"). MatchStatus(ma.LinuxAMD64StateKeys, true, len(ma.LinuxAMD64StateKeys)). MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()). Exec() @@ -254,7 +287,7 @@ var _ = Describe("1.1 registry users:", func() { src := RegistryRef(ZOTHost, ImageRepo, ma.Digest) dstRepo := cpTestRepo("platform-digest") dst := RegistryRef(ZOTHost, dstRepo, "") - ORAS("cp", src, dst, "--platform", "linux/amd64", "-v"). + ORAS("cp", src, dst, "--platform", "linux/amd64"). MatchStatus(ma.LinuxAMD64StateKeys, true, len(ma.LinuxAMD64StateKeys)). MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()). Exec() @@ -267,7 +300,7 @@ var _ = Describe("1.1 registry users:", func() { dstRepo := cpTestRepo("platform-referrers") dst := RegistryRef(ZOTHost, dstRepo, "copiedTag") digest := ma.LinuxAMD64.Digest.String() - ORAS("cp", src, dst, "-r", "--platform", "linux/amd64", "-v"). + ORAS("cp", src, dst, "-r", "--platform", "linux/amd64"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + digest). Exec() @@ -285,7 +318,7 @@ var _ = Describe("1.1 registry users:", func() { dstRepo := cpTestRepo("platform-referrers-no-tag") dst := RegistryRef(ZOTHost, dstRepo, "") digest := ma.LinuxAMD64.Digest.String() - ORAS("cp", src, dst, "-r", "--platform", "linux/amd64", "-v"). + ORAS("cp", src, dst, "-r", "--platform", "linux/amd64"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + digest). Exec() @@ -302,7 +335,7 @@ var _ = Describe("1.1 registry users:", func() { tags := []string{"tag1", "tag2", "tag3"} dstRepo := cpTestRepo("multi-tagging") dst := RegistryRef(ZOTHost, dstRepo, "") - ORAS("cp", src, dst+":"+strings.Join(tags, ","), "-v").MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst+":"+strings.Join(tags, ",")).MatchStatus(foobarStates, true, len(foobarStates)).Exec() for _, tag := range tags { dst := RegistryRef(ZOTHost, dstRepo, tag) CompareRef(src, dst) @@ -317,7 +350,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { repo := cpTestRepo("1.0-mount") src := RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag) dst := RegistryRef(FallbackHost, repo, "") - out := ORAS("cp", src, dst, "-v").Exec() + out := ORAS("cp", src, dst).Exec() Expect(out).Should(gbytes.Say("Mounted fcde2b2edba5 bar")) CompareRef(src, RegistryRef(FallbackHost, repo, foobar.Digest)) }) @@ -327,7 +360,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { stateKeys := append(append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageReferrerConfigStateKeys[0]), foobar.ImageReferrersStateKeys...) src := RegistryRef(ZOTHost, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String()) dst := RegistryRef(FallbackHost, repo, "") - ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, dst).MatchStatus(stateKeys, true, len(stateKeys)).Exec() CompareRef(src, RegistryRef(FallbackHost, repo, foobar.SignatureImageReferrer.Digest.String())) ORAS("discover", "-o", "tree", RegistryRef(FallbackHost, repo, foobar.Digest)). WithDescription("discover referrer via subject").MatchKeyWords(foobar.SignatureImageReferrer.Digest.String(), foobar.SBOMImageReferrer.Digest.String()).Exec() @@ -337,7 +370,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { stateKeys := append(append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageReferrerConfigStateKeys[0]), foobar.ImageReferrersStateKeys...) src := RegistryRef(FallbackHost, ArtifactRepo, foobar.SBOMImageReferrer.Digest.String()) dst := RegistryRef(ZOTHost, repo, "") - ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, dst).MatchStatus(stateKeys, true, len(stateKeys)).Exec() CompareRef(src, RegistryRef(ZOTHost, repo, foobar.SBOMImageReferrer.Digest.String())) ORAS("discover", "-o", "tree", RegistryRef(ZOTHost, repo, foobar.Digest)). WithDescription("discover referrer via subject").MatchKeyWords(foobar.SignatureImageReferrer.Digest.String(), foobar.SBOMImageReferrer.Digest.String()).Exec() @@ -346,7 +379,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { It("should copy an image from a fallback registry to an OCI image layout via digest", func() { dstDir := GinkgoT().TempDir() src := RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag) - ORAS("cp", src, dstDir, "-v", Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dstDir, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", LayoutRef(dstDir, foobar.Digest), Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -360,7 +393,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { // prepare ORAS("cp", RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag), layoutDir, Flags.ToLayout).Exec() // test - ORAS("cp", src, dst, "-v", Flags.FromLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst, Flags.FromLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -377,7 +410,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { ORAS("cp", RegistryRef(ZOTHost, ArtifactRepo, ma.Tag), src, Flags.ToLayout, "-r").Exec() ORAS("cp", RegistryRef(ZOTHost, ArtifactRepo, ma.Tag), src, Flags.ToLayout, "-r", "--platform", "linux/amd64").Exec() // test - ORAS("cp", src, Flags.FromLayout, dst, "-r", "-v", "--platform", "linux/amd64"). + ORAS("cp", src, Flags.FromLayout, dst, "-r", "--platform", "linux/amd64"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()). Exec() @@ -403,7 +436,7 @@ var _ = Describe("OCI layout users:", func() { It("should copy an image from a registry to an OCI image layout via tag", func() { dst := LayoutRef(GinkgoT().TempDir(), "copied") src := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) - ORAS("cp", src, dst, "-v", Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -417,7 +450,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), src, Flags.ToLayout).Exec() // test - ORAS("cp", src, dst, "-v", Flags.FromLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst, Flags.FromLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -432,7 +465,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), src, Flags.ToLayout).Exec() // test - ORAS("cp", src, dst, "-v", Flags.FromLayout, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst, Flags.FromLayout, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -442,7 +475,7 @@ var _ = Describe("OCI layout users:", func() { It("should copy an image from a registry to an OCI image layout via digest", func() { dstDir := GinkgoT().TempDir() src := RegistryRef(ZOTHost, ImageRepo, foobar.Digest) - ORAS("cp", src, dstDir, "-v", Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dstDir, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", LayoutRef(dstDir, foobar.Digest), Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -456,7 +489,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), layoutDir, Flags.ToLayout).Exec() // test - ORAS("cp", src, dst, "-v", Flags.FromLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dst, Flags.FromLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -471,7 +504,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), srcDir, Flags.ToLayout).Exec() // test - ORAS("cp", src, toDir, "-v", Flags.FromLayout, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, toDir, Flags.FromLayout, Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -483,7 +516,7 @@ var _ = Describe("OCI layout users:", func() { src := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) tags := []string{"tag1", "tag2", "tag3"} // test - ORAS("cp", src, dstDir+":"+strings.Join(tags, ","), "-v", Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, dstDir+":"+strings.Join(tags, ","), Flags.ToLayout).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() for _, tag := range tags { @@ -497,7 +530,7 @@ var _ = Describe("OCI layout users:", func() { dst := LayoutRef(GinkgoT().TempDir(), "copied") src := RegistryRef(ZOTHost, ArtifactRepo, foobar.Tag) // test - ORAS("cp", "-r", src, dst, "-v", Flags.ToLayout).MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, dst, Flags.ToLayout).MatchStatus(stateKeys, true, len(stateKeys)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -509,7 +542,7 @@ var _ = Describe("OCI layout users:", func() { toDir := GinkgoT().TempDir() src := RegistryRef(ZOTHost, ArtifactRepo, foobar.Digest) // test - ORAS("cp", "-r", src, toDir, "-v", Flags.ToLayout).MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, toDir, Flags.ToLayout).MatchStatus(stateKeys, true, len(stateKeys)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", LayoutRef(toDir, foobar.Digest), Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -522,7 +555,7 @@ var _ = Describe("OCI layout users:", func() { toDir := GinkgoT().TempDir() dst := LayoutRef(toDir, "copied") // test - ORAS("cp", src, Flags.ToLayout, dst, "-r", "-v"). + ORAS("cp", src, Flags.ToLayout, dst, "-r"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.Digest). Exec() @@ -551,7 +584,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ArtifactRepo, ma.Tag), src, Flags.ToLayout, "-r").Exec() // test - ORAS("cp", src, Flags.FromLayout, dst, "-r", "-v"). + ORAS("cp", src, Flags.FromLayout, dst, "-r"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.Digest). Exec() @@ -582,7 +615,7 @@ var _ = Describe("OCI layout users:", func() { ORAS("cp", RegistryRef(ZOTHost, ArtifactRepo, ma.Tag), src, Flags.ToLayout, "-r").Exec() ORAS("cp", RegistryRef(ZOTHost, ArtifactRepo, ma.Tag), src, Flags.ToLayout, "-r", "--platform", "linux/amd64").Exec() // test - ORAS("cp", src, Flags.FromLayout, dst, "-r", "-v", "--platform", "linux/amd64"). + ORAS("cp", src, Flags.FromLayout, dst, "-r", "--platform", "linux/amd64"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()). Exec() @@ -607,7 +640,7 @@ var _ = Describe("OCI layout users:", func() { toDir := GinkgoT().TempDir() dst := LayoutRef(toDir, "copied") // test - ORAS("cp", src, Flags.ToLayout, dst, "-r", "-v", "--platform", "linux/amd64"). + ORAS("cp", src, Flags.ToLayout, dst, "-r", "--platform", "linux/amd64"). MatchStatus(stateKeys, true, len(stateKeys)). MatchKeyWords("Digest: " + ma.LinuxAMD64.Digest.String()). Exec() @@ -633,7 +666,7 @@ var _ = Describe("OCI layout users:", func() { src := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) ref := "copied" dst := LayoutRef(layoutDir, ref) - ORAS("cp", src, ref, "-v", Flags.ToLayoutPath, layoutDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, ref, Flags.ToLayoutPath, layoutDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -648,7 +681,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), src, Flags.ToLayout).Exec() // test - ORAS("cp", ref, dst, "-v", Flags.FromLayoutPath, layoutDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", ref, dst, Flags.FromLayoutPath, layoutDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -665,7 +698,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), src, Flags.ToLayout).Exec() // test - ORAS("cp", srcRef, dstRef, "-v", Flags.FromLayoutPath, srcDir, Flags.ToLayoutPath, toDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", srcRef, dstRef, Flags.FromLayoutPath, srcDir, Flags.ToLayoutPath, toDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -675,7 +708,7 @@ var _ = Describe("OCI layout users:", func() { It("should copy an image from a registry to an OCI image layout via digest using --oci-layout-path", func() { dstDir := GinkgoT().TempDir() src := RegistryRef(ZOTHost, ImageRepo, foobar.Digest) - ORAS("cp", src, foobar.Digest, "-v", Flags.ToLayoutPath, dstDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", src, foobar.Digest, Flags.ToLayoutPath, dstDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", LayoutRef(dstDir, foobar.Digest), Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -689,7 +722,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), layoutDir, Flags.ToLayout).Exec() // test - ORAS("cp", foobar.Digest, dst, "-v", Flags.FromLayoutPath, layoutDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", foobar.Digest, dst, Flags.FromLayoutPath, layoutDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -704,7 +737,7 @@ var _ = Describe("OCI layout users:", func() { // prepare ORAS("cp", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), srcDir, Flags.ToLayout).Exec() // test - ORAS("cp", foobar.Digest, foobar.Digest, "-v", Flags.FromLayoutPath, srcDir, Flags.ToLayoutPath, toDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() + ORAS("cp", foobar.Digest, foobar.Digest, Flags.FromLayoutPath, srcDir, Flags.ToLayoutPath, toDir).MatchStatus(foobarStates, true, len(foobarStates)).Exec() // validate srcManifest := ORAS("manifest", "fetch", src, Flags.Layout).WithDescription("fetch from source to validate").Exec().Out.Contents() dstManifest := ORAS("manifest", "fetch", dst, Flags.Layout).WithDescription("fetch from destination to validate").Exec().Out.Contents() @@ -719,7 +752,7 @@ var _ = Describe("OCI image spec v1.1.0-rc2 artifact users:", func() { digest := foobar.SBOMArtifactReferrer.Digest.String() src := RegistryRef(Host, ArtifactRepo, digest) dst := RegistryRef(Host, cpTestRepo("referrers"), digest) - ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, dst).MatchStatus(stateKeys, true, len(stateKeys)).Exec() CompareRef(src, dst) }) }) diff --git a/test/e2e/suite/command/discover.go b/test/e2e/suite/command/discover.go index 977c1b03c..5d2723dc7 100644 --- a/test/e2e/suite/command/discover.go +++ b/test/e2e/suite/command/discover.go @@ -52,7 +52,7 @@ var _ = Describe("ORAS beginners:", func() { RunAndShowPreviewInHelp([]string{"discover"}) It("should show preview and help doc", func() { - out := ORAS("discover", "--help").MatchKeyWords(feature.Preview.Mark+" Discover", feature.Preview.Description, ExampleDesc).Exec() + out := ORAS("discover", "--help").MatchKeyWords(feature.Preview.Mark+" Discover", feature.Preview.Description, ExampleDesc).Exec().Out gomega.Expect(out).Should(gbytes.Say("--distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) diff --git a/test/e2e/suite/command/manifest.go b/test/e2e/suite/command/manifest.go index c7958b6e7..4b55dc145 100644 --- a/test/e2e/suite/command/manifest.go +++ b/test/e2e/suite/command/manifest.go @@ -32,6 +32,7 @@ import ( "oras.land/oras/test/e2e/internal/testdata/foobar" "oras.land/oras/test/e2e/internal/testdata/multi_arch" . "oras.land/oras/test/e2e/internal/utils" + "oras.land/oras/test/e2e/internal/utils/match" ) func prepare(src string, dst string) { @@ -53,7 +54,7 @@ var _ = Describe("ORAS beginners:", func() { When("running manifest command", func() { When("running `manifest push`", func() { It("should show help doc with feature flags", func() { - out := ORAS("manifest", "push", "--help").MatchKeyWords(ExampleDesc).Exec() + out := ORAS("manifest", "push", "--help").MatchKeyWords(ExampleDesc).Exec().Out gomega.Expect(out).Should(gbytes.Say("--distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) @@ -63,6 +64,38 @@ var _ = Describe("ORAS beginners:", func() { Exec() }) + It("should not show --verbose in help doc", func() { + out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("--verbose")) + }) + + It("should show deprecation message and print unnamed status output for --verbose", func() { + manifest := `{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53},"layers":[]}` + manifestDigest := "sha256:bc1a59d49fc7c7b0a31f22ca0c743ecdabdb736777e3d9672fa9d97b4fe323f4" + + tag := "test-verbose" + ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), "-", "--verbose"). + WithInput(strings.NewReader(manifest)). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchKeyWords("Pushed", RegistryRef(ZOTHost, ImageRepo, tag), "Digest:", manifestDigest). + MatchStatus([]match.StateKey{{Digest: "bc1a59d49fc7", Name: "application/vnd.oci.image.manifest.v1+json"}}, true, 1). + Exec() + }) + + It("should show deprecation message and should NOT print unnamed status output for --verbose=false", func() { + manifest := `{"schemaVersion":2,"mediaType":"application/vnd.oci.image.manifest.v1+json","config":{"mediaType":"application/vnd.oci.image.config.v1+json","digest":"sha256:fe9dbc99451d0517d65e048c309f0b5afb2cc513b7a3d456b6cc29fe641386c5","size":53},"layers":[]}` + manifestDigest := "sha256:bc1a59d49fc7c7b0a31f22ca0c743ecdabdb736777e3d9672fa9d97b4fe323f4" + + tag := "test-verbose-false" + out := ORAS("manifest", "push", RegistryRef(ZOTHost, ImageRepo, tag), "-", "--verbose=false"). + WithInput(strings.NewReader(manifest)). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchKeyWords("Pushed", RegistryRef(ZOTHost, ImageRepo, tag), "Digest:", manifestDigest). + Exec().Out + // should not print status output for unnamed blobs + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.image.manifest.v1+json")) + }) + It("should fail and show detailed error description if no argument provided", func() { err := ORAS("manifest", "push").ExpectFailure().Exec().Err gomega.Expect(err).Should(gbytes.Say("Error")) @@ -123,7 +156,7 @@ var _ = Describe("ORAS beginners:", func() { When("running `manifest delete`", func() { It("should show help doc with feature flags", func() { - out := ORAS("manifest", "delete", "--help").MatchKeyWords(ExampleDesc).Exec() + out := ORAS("manifest", "delete", "--help").MatchKeyWords(ExampleDesc).Exec().Out gomega.Expect(out).Should(gbytes.Say("--distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) diff --git a/test/e2e/suite/command/pull.go b/test/e2e/suite/command/pull.go index d463cf582..f31436e7a 100644 --- a/test/e2e/suite/command/pull.go +++ b/test/e2e/suite/command/pull.go @@ -43,19 +43,47 @@ var _ = Describe("ORAS beginners:", func() { gomega.Expect(out).Should(gbytes.Say("--include-subject\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) + It("should not show --verbose in help doc", func() { + out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("--verbose")) + }) + It("should show text as default format type in help doc", func() { MatchDefaultFlagValue("format", "text", "pull") }) + It("should show deprecation message and print unnamed status output for --verbose", func() { + tempDir := PrepareTempFiles() + ref := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) + stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey) + ORAS("pull", ref, "--verbose"). + WithWorkDir(tempDir). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(stateKeys, true, len(stateKeys)). + Exec() + }) + + It("should show deprecation message and should NOT print unnamed status output for --verbose=false", func() { + tempDir := PrepareTempFiles() + ref := RegistryRef(ZOTHost, ImageRepo, foobar.Tag) + stateKeys := foobar.ImageLayerStateKeys + out := ORAS("pull", ref, "--verbose=false"). + WithWorkDir(tempDir). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(stateKeys, false, len(stateKeys)). + Exec().Out + // should not print status output for unnamed blobs + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.image.manifest.v1+json")) + }) + hintMsg := func(reference string) string { return fmt.Sprintf("Skipped pulling layers without file name in \"org.opencontainers.image.title\"\nUse 'oras copy %s --to-oci-layout ' to pull all layers.\n", reference) } It("should show hint for unnamed layer", func() { tempDir := PrepareTempFiles() ref := RegistryRef(ZOTHost, ArtifactRepo, unnamed.Tag) - ORAS("pull", ref). - WithWorkDir(tempDir). - MatchContent(hintMsg(ref)).Exec() + out := ORAS("pull", ref).WithWorkDir(tempDir).Exec().Out + gomega.Expect(out).Should(gbytes.Say(hintMsg(ref))) }) It("should not show hint for unnamed config blob", func() { @@ -184,7 +212,7 @@ var _ = Describe("OCI spec 1.1 registry users:", func() { pullRoot := "pulled" tempDir := PrepareTempFiles() stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageConfigStateKey(configName)) - ORAS("pull", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), "-v", "--config", configName, "-o", pullRoot). + ORAS("pull", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), "--config", configName, "-o", pullRoot). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() // check config @@ -200,7 +228,7 @@ var _ = Describe("OCI spec 1.1 registry users:", func() { WithWorkDir(tempDir).Exec() } - ORAS("pull", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), "-v", "-o", pullRoot, "--keep-old-files"). + ORAS("pull", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), "-o", pullRoot, "--keep-old-files"). ExpectFailure(). WithDescription("fail if overwrite old files are disabled") }) @@ -209,7 +237,7 @@ var _ = Describe("OCI spec 1.1 registry users:", func() { pullRoot := "pulled" tempDir := PrepareTempFiles() stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey) - ORAS("pull", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), "-v", "--config", fmt.Sprintf("%s:%s", configName, "???"), "-o", pullRoot). + ORAS("pull", RegistryRef(ZOTHost, ImageRepo, foobar.Tag), "--config", fmt.Sprintf("%s:%s", configName, "???"), "-o", pullRoot). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() // check config @@ -229,7 +257,7 @@ var _ = Describe("OCI spec 1.1 registry users:", func() { foobar.ManifestStateKey), foobar.ImageReferrersStateKeys..., ) - ORAS("pull", RegistryRef(ZOTHost, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String()), "-v", "--include-subject"). + ORAS("pull", RegistryRef(ZOTHost, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String()), "--include-subject"). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() }) @@ -275,19 +303,19 @@ var _ = Describe("OCI spec 1.1 registry users:", func() { }) It("should pull specific platform", func() { - ORAS("pull", RegistryRef(ZOTHost, ImageRepo, "multi"), "--platform", "linux/amd64", "-v", "-o", GinkgoT().TempDir()). + ORAS("pull", RegistryRef(ZOTHost, ImageRepo, "multi"), "--platform", "linux/amd64", "-o", GinkgoT().TempDir()). MatchStatus(multi_arch.LinuxAMD64StateKeys, true, len(multi_arch.LinuxAMD64StateKeys)).Exec() }) It("should pull an artifact with blob", func() { pullRoot := GinkgoT().TempDir() - ORAS("pull", RegistryRef(ZOTHost, ArtifactRepo, blob.Tag), "-v", "-o", pullRoot).Exec() + ORAS("pull", RegistryRef(ZOTHost, ArtifactRepo, blob.Tag), "-o", pullRoot).Exec() Expect(filepath.Join(pullRoot, multi_arch.LayerName)).Should(BeAnExistingFile()) }) It("should pull an artifact with config", func() { pullRoot := GinkgoT().TempDir() - ORAS("pull", RegistryRef(ZOTHost, ArtifactRepo, config.Tag), "-v", "-o", pullRoot).Exec() + ORAS("pull", RegistryRef(ZOTHost, ArtifactRepo, config.Tag), "-o", pullRoot).Exec() Expect(filepath.Join(pullRoot, multi_arch.LayerName)).Should(BeAnExistingFile()) }) @@ -296,7 +324,7 @@ var _ = Describe("OCI spec 1.1 registry users:", func() { stateKeys := append(append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageReferrerConfigStateKeys[0]), foobar.ImageReferrersStateKeys...) src := RegistryRef(ZOTHost, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String()) dst := RegistryRef(FallbackHost, repo, "") - ORAS("cp", "-r", src, dst, "-v").MatchStatus(stateKeys, true, len(stateKeys)).Exec() + ORAS("cp", "-r", src, dst).MatchStatus(stateKeys, true, len(stateKeys)).Exec() CompareRef(src, RegistryRef(FallbackHost, repo, foobar.SignatureImageReferrer.Digest.String())) ORAS("discover", "-o", "tree", RegistryRef(FallbackHost, repo, foobar.Digest)). WithDescription("discover referrer via subject").MatchKeyWords(foobar.SignatureImageReferrer.Digest.String(), foobar.SBOMImageReferrer.Digest.String()).Exec() @@ -310,7 +338,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { configName := "test.config" tempDir := PrepareTempFiles() stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageConfigStateKey(configName)) - ORAS("pull", RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag), "-v", "--config", configName, "-o", pullRoot). + ORAS("pull", RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag), "--config", configName, "-o", pullRoot). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() // check config @@ -326,7 +354,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { WithWorkDir(tempDir).Exec() } - ORAS("pull", RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag), "-v", "-o", pullRoot, "--keep-old-files"). + ORAS("pull", RegistryRef(FallbackHost, ArtifactRepo, foobar.Tag), "-o", pullRoot, "--keep-old-files"). ExpectFailure(). WithDescription("fail if overwrite old files are disabled") }) @@ -338,7 +366,7 @@ var _ = Describe("OCI spec 1.0 registry users:", func() { foobar.ManifestStateKey), foobar.ImageReferrersStateKeys..., ) - ORAS("pull", RegistryRef(FallbackHost, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String()), "-v", "--include-subject"). + ORAS("pull", RegistryRef(FallbackHost, ArtifactRepo, foobar.SignatureImageReferrer.Digest.String()), "--include-subject"). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() }) @@ -353,7 +381,7 @@ var _ = Describe("OCI image layout users:", func() { pullRoot := "pulled" root := PrepareTempOCI(ImageRepo) stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageConfigStateKey(configName)) - ORAS("pull", Flags.Layout, LayoutRef(root, foobar.Tag), "-v", "--config", configName, "-o", pullRoot). + ORAS("pull", Flags.Layout, LayoutRef(root, foobar.Tag), "--config", configName, "-o", pullRoot). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(root).Exec() // check config @@ -369,7 +397,7 @@ var _ = Describe("OCI image layout users:", func() { WithWorkDir(root).Exec() } - ORAS("pull", Flags.Layout, LayoutRef(root, foobar.Tag), "-v", "-o", pullRoot, "--keep-old-files"). + ORAS("pull", Flags.Layout, LayoutRef(root, foobar.Tag), "-o", pullRoot, "--keep-old-files"). ExpectFailure(). WithDescription("fail if overwrite old files are disabled") }) @@ -378,7 +406,7 @@ var _ = Describe("OCI image layout users:", func() { pullRoot := "pulled" root := PrepareTempOCI(ImageRepo) stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey) - ORAS("pull", Flags.Layout, LayoutRef(root, foobar.Tag), "-v", "--config", fmt.Sprintf("%s:%s", configName, "???"), "-o", pullRoot). + ORAS("pull", Flags.Layout, LayoutRef(root, foobar.Tag), "--config", fmt.Sprintf("%s:%s", configName, "???"), "-o", pullRoot). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(root).Exec() // check config @@ -398,14 +426,14 @@ var _ = Describe("OCI image layout users:", func() { foobar.ManifestStateKey), foobar.ImageReferrersStateKeys..., ) - ORAS("pull", Flags.Layout, LayoutRef(root, foobar.SignatureImageReferrer.Digest.String()), "-v", "--include-subject"). + ORAS("pull", Flags.Layout, LayoutRef(root, foobar.SignatureImageReferrer.Digest.String()), "--include-subject"). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(root).Exec() }) It("should pull specific platform", func() { root := PrepareTempOCI(ImageRepo) - ORAS("pull", Flags.Layout, LayoutRef(root, multi_arch.Tag), "--platform", "linux/amd64", "-v", "-o", root). + ORAS("pull", Flags.Layout, LayoutRef(root, multi_arch.Tag), "--platform", "linux/amd64", "-o", root). MatchStatus(multi_arch.LinuxAMD64StateKeys, true, len(multi_arch.LinuxAMD64StateKeys)).Exec() }) }) @@ -417,7 +445,7 @@ var _ = Describe("OCI image spec v1.1.0-rc2 artifact users:", func() { configName := "test.config" tempDir := PrepareTempFiles() stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageConfigStateKey(configName)) - ORAS("pull", RegistryRef(Host, ImageRepo, foobar.Tag), "-v", "--config", configName, "-o", pullRoot). + ORAS("pull", RegistryRef(Host, ImageRepo, foobar.Tag), "--config", configName, "-o", pullRoot). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() // check config @@ -433,7 +461,7 @@ var _ = Describe("OCI image spec v1.1.0-rc2 artifact users:", func() { WithWorkDir(tempDir).Exec() } - ORAS("pull", RegistryRef(Host, ImageRepo, foobar.Tag), "-v", "-o", pullRoot, "--keep-old-files"). + ORAS("pull", RegistryRef(Host, ImageRepo, foobar.Tag), "-o", pullRoot, "--keep-old-files"). ExpectFailure(). WithDescription("fail if overwrite old files are disabled") }) @@ -445,7 +473,7 @@ var _ = Describe("OCI image spec v1.1.0-rc2 artifact users:", func() { foobar.ManifestStateKey), foobar.ArtifactReferrerStateKeys..., ) - ORAS("pull", RegistryRef(Host, ArtifactRepo, foobar.SignatureArtifactReferrer.Digest.String()), "-v", "--include-subject"). + ORAS("pull", RegistryRef(Host, ArtifactRepo, foobar.SignatureArtifactReferrer.Digest.String()), "--include-subject"). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() }) diff --git a/test/e2e/suite/command/push.go b/test/e2e/suite/command/push.go index 339aab025..e489283f9 100644 --- a/test/e2e/suite/command/push.go +++ b/test/e2e/suite/command/push.go @@ -41,10 +41,44 @@ var _ = Describe("ORAS beginners:", func() { gomega.Expect(out).Should(gbytes.Say("--image-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark))) }) + It("should not show --verbose in help doc", func() { + out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out + gomega.Expect(out).ShouldNot(gbytes.Say("--verbose")) + }) + It("should show text as default format type in help doc", func() { MatchDefaultFlagValue("format", "text", "push") }) + It("should show deprecation message and print unnamed status output for --verbose", func() { + repo := pushTestRepo("test-verbose") + tag := "e2e" + tempDir := PrepareTempFiles() + stateKeys := []match.StateKey{ + artifact.DefaultConfigStateKey, + } + + ORAS("push", RegistryRef(ZOTHost, repo, tag), "--verbose"). + WithWorkDir(tempDir). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + MatchStatus(stateKeys, true, len(stateKeys)). + Exec() + }) + + It("should show deprecation message and should NOT print unnamed status output for --verbose=false", func() { + repo := pushTestRepo("test-verbose-false") + tag := "e2e" + tempDir := PrepareTempFiles() + + out := ORAS("push", RegistryRef(ZOTHost, repo, tag), "--verbose=false"). + WithWorkDir(tempDir). + MatchErrKeyWords(feature.DeprecationMessageVerboseFlag). + Exec().Out + // should not print status output for unnamed blobs + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.empty.v1+json")) + gomega.Expect(out).ShouldNot(gbytes.Say("application/vnd.oci.image.manifest.v1+json")) + }) + It("should fail and show detailed error description if no argument provided", func() { err := ORAS("push").ExpectFailure().Exec().Err gomega.Expect(err).Should(gbytes.Say("Error")) @@ -143,7 +177,7 @@ var _ = Describe("Remote registry users:", func() { tempDir := PrepareTempFiles() ref := RegistryRef(ZOTHost, repo, tag) - ORAS("push", ref, foobar.FileBarName, "-v"). + ORAS("push", ref, foobar.FileBarName). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() @@ -159,7 +193,7 @@ var _ = Describe("Remote registry users:", func() { ref := RegistryRef(ZOTHost, repo, tag) absBarName := filepath.Join(PrepareTempFiles(), foobar.FileBarName) - ORAS("push", ref, absBarName, "-v", "--disable-path-validation"). + ORAS("push", ref, absBarName, "--disable-path-validation"). Exec() // validate @@ -181,7 +215,7 @@ var _ = Describe("Remote registry users:", func() { ref := RegistryRef(ZOTHost, repo, tag) absBarName := filepath.Join(PrepareTempFiles(), foobar.FileBarName) // test - ORAS("push", ref, absBarName, "-v"). + ORAS("push", ref, absBarName). MatchErrKeyWords("--disable-path-validation"). ExpectFailure(). Exec() @@ -192,7 +226,7 @@ var _ = Describe("Remote registry users:", func() { tempDir := PrepareTempFiles() extraTag := "2e2" - ORAS("push", fmt.Sprintf("%s,%s", RegistryRef(ZOTHost, repo, tag), extraTag), foobar.FileBarName, "-v", "--format", "go-template={{range .referenceAsTags}}{{println .}}{{end}}"). + ORAS("push", fmt.Sprintf("%s,%s", RegistryRef(ZOTHost, repo, tag), extraTag), foobar.FileBarName, "--format", "go-template={{range .referenceAsTags}}{{println .}}{{end}}"). MatchContent(fmt.Sprintf("%s\n%s\n", RegistryRef(ZOTHost, repo, extraTag), RegistryRef(ZOTHost, repo, tag))). WithWorkDir(tempDir).Exec() @@ -212,7 +246,7 @@ var _ = Describe("Remote registry users:", func() { tempDir := PrepareTempFiles() extraTag := "2e2" - out := ORAS("push", fmt.Sprintf("%s,%s", RegistryRef(ZOTHost, repo, tag), extraTag), foobar.FileBarName, "-v", "--format", "json"). + out := ORAS("push", fmt.Sprintf("%s,%s", RegistryRef(ZOTHost, repo, tag), extraTag), foobar.FileBarName, "--format", "json"). WithWorkDir(tempDir). Exec().Out.Contents() Expect(json.Unmarshal(out, &struct{}{})).ShouldNot(HaveOccurred()) @@ -222,7 +256,7 @@ var _ = Describe("Remote registry users:", func() { repo := pushTestRepo("layer-mediatype") layerType := "layer/type" tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName+":"+layerType, "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName+":"+layerType). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -237,7 +271,7 @@ var _ = Describe("Remote registry users:", func() { layerType := "layer/type" tempDir := PrepareTempFiles() exportPath := "packed.json" - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName+":"+layerType, "-v", "--export-manifest", exportPath). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName+":"+layerType, "--export-manifest", exportPath). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -249,7 +283,7 @@ var _ = Describe("Remote registry users:", func() { repo := pushTestRepo("config") tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", foobar.FileConfigName, foobar.FileBarName, "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", foobar.FileConfigName, foobar.FileBarName). MatchStatus([]match.StateKey{ foobar.FileConfigStateKey, foobar.FileBarStateKey, @@ -271,7 +305,7 @@ var _ = Describe("Remote registry users:", func() { configType := "my/config/type" tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName). MatchStatus([]match.StateKey{ {Digest: foobar.FileConfigStateKey.Digest, Name: configType}, foobar.FileBarStateKey, @@ -294,7 +328,7 @@ var _ = Describe("Remote registry users:", func() { configType := "config/type" tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName). MatchStatus([]match.StateKey{ {Digest: foobar.FileConfigStateKey.Digest, Name: configType}, foobar.FileBarStateKey, @@ -317,7 +351,7 @@ var _ = Describe("Remote registry users:", func() { value := "image-anno-value" tempDir := PrepareTempFiles() // test - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v", "--annotation", fmt.Sprintf("%s=%s", key, value)). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--annotation", fmt.Sprintf("%s=%s", key, value)). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -331,7 +365,7 @@ var _ = Describe("Remote registry users:", func() { repo := pushTestRepo("file-annotation") tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v", "--annotation-file", "foobar/annotation.json", "--config", foobar.FileConfigName). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--annotation-file", "foobar/annotation.json", "--config", foobar.FileConfigName). MatchStatus(statusKeys, true, 1). WithWorkDir(tempDir).Exec() @@ -356,7 +390,7 @@ var _ = Describe("Remote registry users:", func() { annotationValue := "value" // test - ORAS("push", RegistryRef(ZOTHost, repo, tag), "-a", fmt.Sprintf("%s=%s", annotationKey, annotationValue), "-v", "--artifact-type", artifactType). + ORAS("push", RegistryRef(ZOTHost, repo, tag), "-a", fmt.Sprintf("%s=%s", annotationKey, annotationValue), "--artifact-type", artifactType). MatchStatus([]match.StateKey{artifact.DefaultConfigStateKey}, true, 1). WithWorkDir(tempDir).Exec() @@ -414,7 +448,7 @@ var _ = Describe("Remote registry users:", func() { repo := pushTestRepo("artifact-with-blob") tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName). MatchStatus([]match.StateKey{foobar.FileBarStateKey, artifact.DefaultConfigStateKey}, true, 2). WithWorkDir(tempDir).Exec() @@ -431,7 +465,7 @@ var _ = Describe("Remote registry users:", func() { repo := pushTestRepo("print-artifact-type-v1-1") tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v", "--image-spec", "v1.1"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--image-spec", "v1.1"). MatchKeyWords("ArtifactType: ", "application/vnd.unknown.artifact.v1"). WithWorkDir(tempDir).Exec() }) @@ -441,7 +475,7 @@ var _ = Describe("Remote registry users:", func() { configType := "config/type" tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v", "--image-spec", "v1.0"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "--image-spec", "v1.0"). MatchKeyWords("ArtifactType: ", configType). WithWorkDir(tempDir).Exec() }) @@ -450,7 +484,7 @@ var _ = Describe("Remote registry users:", func() { repo := pushTestRepo("v1.1-artifact") tempDir := PrepareTempFiles() - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "-v", "--image-spec", "v1.1"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--image-spec", "v1.1"). MatchStatus([]match.StateKey{foobar.FileBarStateKey, artifact.DefaultConfigStateKey}, true, 2). WithWorkDir(tempDir).Exec() @@ -468,7 +502,7 @@ var _ = Describe("Remote registry users:", func() { tempDir := PrepareTempFiles() configType := "test/config+json" - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType)). MatchStatus([]match.StateKey{ foobar.FileBarStateKey, {Digest: foobar.FileConfigStateKey.Digest, Name: configType}, @@ -491,7 +525,7 @@ var _ = Describe("Remote registry users:", func() { artifactType := "test/artifact+json" configType := "test/config+json" - ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--artifact-type", artifactType, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), "-v"). + ORAS("push", RegistryRef(ZOTHost, repo, tag), foobar.FileBarName, "--artifact-type", artifactType, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType)). MatchStatus([]match.StateKey{ foobar.FileBarStateKey, {Digest: foobar.FileConfigStateKey.Digest, Name: configType}, @@ -522,7 +556,7 @@ var _ = Describe("OCI image layout users:", func() { tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) // test - ORAS("push", Flags.Layout, ref, foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, ref, foobar.FileBarName). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -537,7 +571,7 @@ var _ = Describe("OCI image layout users:", func() { ref := LayoutRef(tempDir, tag) extraTag := "2e2" - ORAS("push", Flags.Layout, fmt.Sprintf("%s,%s", ref, extraTag), foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, fmt.Sprintf("%s,%s", ref, extraTag), foobar.FileBarName). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() @@ -556,7 +590,7 @@ var _ = Describe("OCI image layout users:", func() { layerType := "layer.type" tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) - ORAS("push", Flags.Layout, ref, foobar.FileBarName+":"+layerType, "-v"). + ORAS("push", Flags.Layout, ref, foobar.FileBarName+":"+layerType). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -571,7 +605,7 @@ var _ = Describe("OCI image layout users:", func() { layerType := "layer.type" exportPath := "packed.json" ref := LayoutRef(tempDir, tag) - ORAS("push", ref, Flags.Layout, foobar.FileBarName+":"+layerType, "-v", "--export-manifest", exportPath). + ORAS("push", ref, Flags.Layout, foobar.FileBarName+":"+layerType, "--export-manifest", exportPath). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -582,7 +616,7 @@ var _ = Describe("OCI image layout users:", func() { It("should push files with customized config file", func() { tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) - ORAS("push", Flags.Layout, ref, "--config", foobar.FileConfigName, foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, ref, "--config", foobar.FileConfigName, foobar.FileBarName). MatchStatus([]match.StateKey{ foobar.FileConfigStateKey, foobar.FileBarStateKey, @@ -603,7 +637,7 @@ var _ = Describe("OCI image layout users:", func() { configType := "config/type" tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) - ORAS("push", Flags.Layout, ref, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, ref, "--config", fmt.Sprintf("%s:%s", foobar.FileConfigName, configType), foobar.FileBarName). MatchStatus([]match.StateKey{ {Digest: foobar.FileConfigStateKey.Digest, Name: configType}, foobar.FileBarStateKey, @@ -623,7 +657,7 @@ var _ = Describe("OCI image layout users:", func() { It("should push files with platform", func() { tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) - ORAS("push", Flags.Layout, ref, "--artifact-platform", "darwin/arm64", foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, ref, "--artifact-platform", "darwin/arm64", foobar.FileBarName). MatchStatus([]match.StateKey{ foobar.PlatformConfigStateKey, foobar.FileBarStateKey, @@ -647,7 +681,7 @@ var _ = Describe("OCI image layout users:", func() { It("should fail to customize config mediaType when baking config blob with platform for v1.0", func() { tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) - ORAS("push", Flags.Layout, ref, "--image-spec", "v1.0", "--artifact-type", "test/artifact+json", "--artifact-platform", "darwin/arm64", foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, ref, "--image-spec", "v1.0", "--artifact-type", "test/artifact+json", "--artifact-platform", "darwin/arm64", foobar.FileBarName). ExpectFailure(). Exec() }) @@ -655,7 +689,7 @@ var _ = Describe("OCI image layout users:", func() { It("should push files with platform with no artifactType for v1.0", func() { tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) - ORAS("push", Flags.Layout, ref, "--image-spec", "v1.0", "--artifact-platform", "darwin/arm64", foobar.FileBarName, "-v"). + ORAS("push", Flags.Layout, ref, "--image-spec", "v1.0", "--artifact-platform", "darwin/arm64", foobar.FileBarName). MatchStatus([]match.StateKey{ foobar.PlatformV1DEfaultConfigStateKey, foobar.FileBarStateKey, @@ -678,7 +712,7 @@ var _ = Describe("OCI image layout users:", func() { key := "image-anno-key" value := "image-anno-value" // test - ORAS("push", Flags.Layout, ref, foobar.FileBarName, "-v", "--annotation", fmt.Sprintf("%s=%s", key, value)). + ORAS("push", Flags.Layout, ref, foobar.FileBarName, "--annotation", fmt.Sprintf("%s=%s", key, value)). MatchStatus(statusKeys, true, len(statusKeys)). WithWorkDir(tempDir).Exec() // validate @@ -692,7 +726,7 @@ var _ = Describe("OCI image layout users:", func() { tempDir := PrepareTempFiles() ref := LayoutRef(tempDir, tag) // test - ORAS("push", ref, Flags.Layout, foobar.FileBarName, "-v", "--annotation-file", "foobar/annotation.json", "--config", foobar.FileConfigName). + ORAS("push", ref, Flags.Layout, foobar.FileBarName, "--annotation-file", "foobar/annotation.json", "--config", foobar.FileConfigName). MatchStatus(statusKeys, true, 1). WithWorkDir(tempDir).Exec() diff --git a/test/e2e/suite/command/resolve_host.go b/test/e2e/suite/command/resolve_host.go index a6e95bd47..724705b05 100644 --- a/test/e2e/suite/command/resolve_host.go +++ b/test/e2e/suite/command/resolve_host.go @@ -126,7 +126,7 @@ var _ = Describe("1.1 registry users:", func() { It("should copy an image with source resolve DNS rules", func() { repo := testRepo("cp/from") dst := RegistryRef(Host, repo, "copied") - ORAS(append([]string{"cp", RegistryRef(mockedHost, ImageRepo, foobar.Tag), dst, "-v"}, from...)...). + ORAS(append([]string{"cp", RegistryRef(mockedHost, ImageRepo, foobar.Tag), dst}, from...)...). MatchStatus(foobarStates, true, len(foobarStates)). Exec() CompareRef(RegistryRef(Host, ImageRepo, foobar.Tag), dst) @@ -136,7 +136,7 @@ var _ = Describe("1.1 registry users:", func() { src := RegistryRef(Host, ImageRepo, foobar.Tag) repo := testRepo("cp/to") tag := "copied" - ORAS(append([]string{"cp", src, RegistryRef(mockedHost, repo, tag), "-v"}, to...)...). + ORAS(append([]string{"cp", src, RegistryRef(mockedHost, repo, tag)}, to...)...). MatchStatus(foobarStates, true, len(foobarStates)). Exec() CompareRef(src, RegistryRef(Host, repo, tag)) @@ -147,7 +147,7 @@ var _ = Describe("1.1 registry users:", func() { repo := testRepo("cp/base") tag := "copied" flags := append(to[2:], "--resolve", unary[1]) //hack to chop the destination flags off - ORAS(append([]string{"cp", src, RegistryRef(mockedHost, repo, tag), "-v"}, flags...)...). + ORAS(append([]string{"cp", src, RegistryRef(mockedHost, repo, tag)}, flags...)...). MatchStatus(foobarStates, true, len(foobarStates)). Exec() CompareRef(src, RegistryRef(Host, repo, tag)) @@ -157,7 +157,7 @@ var _ = Describe("1.1 registry users:", func() { repo := testRepo("cp/override") tag := "copied" flags := append(append(to, from...), "--resolve", mockedHost+":80:1.1.1.1:5000") - ORAS(append([]string{"cp", RegistryRef(mockedHost, ImageRepo, foobar.Tag), RegistryRef(mockedHost, repo, tag), "-v"}, flags...)...). + ORAS(append([]string{"cp", RegistryRef(mockedHost, ImageRepo, foobar.Tag), RegistryRef(mockedHost, repo, tag)}, flags...)...). MatchStatus(foobarStates, true, len(foobarStates)). Exec() CompareRef(RegistryRef(Host, ImageRepo, foobar.Tag), RegistryRef(Host, repo, tag)) @@ -215,7 +215,7 @@ var _ = Describe("1.1 registry users:", func() { tempDir := PrepareTempFiles() stateKeys := append(foobar.ImageLayerStateKeys, foobar.ManifestStateKey, foobar.ImageConfigStateKey(configName)) // test - ORAS(append([]string{"pull", RegistryRef(mockedHost, ImageRepo, foobar.Tag), "-v", "--config", configName, "-o", pullRoot}, unary...)...). + ORAS(append([]string{"pull", RegistryRef(mockedHost, ImageRepo, foobar.Tag), "--config", configName, "-o", pullRoot}, unary...)...). MatchStatus(stateKeys, true, len(stateKeys)). WithWorkDir(tempDir).Exec() // validate config and layers @@ -235,7 +235,7 @@ var _ = Describe("1.1 registry users:", func() { It("should push files without customized media types", func() { repo := testRepo("push") tempDir := PrepareTempFiles() - ORAS(append([]string{"push", RegistryRef(mockedHost, repo, foobar.Tag), "-v"}, append(foobar.FileLayerNames, unary...)...)...). + ORAS(append([]string{"push", RegistryRef(mockedHost, repo, foobar.Tag)}, append(foobar.FileLayerNames, unary...)...)...). MatchStatus(foobar.FileStateKeys, true, len(foobar.FileStateKeys)). WithWorkDir(tempDir).Exec() }) diff --git a/test/e2e/suite/scenario/oci_artifact.go b/test/e2e/suite/scenario/oci_artifact.go index ee726f8f4..5b1a4e521 100644 --- a/test/e2e/suite/scenario/oci_artifact.go +++ b/test/e2e/suite/scenario/oci_artifact.go @@ -37,7 +37,7 @@ var _ = Describe("OCI artifact users:", Ordered, func() { pulledManifest := "packed.json" pullRoot := "pulled" It("should push and pull an artifact", func() { - ORAS("push", RegistryRef(ZOTHost, repo, tag), "--artifact-type", "test/artifact", foobar.FileLayerNames[0], foobar.FileLayerNames[1], foobar.FileLayerNames[2], "-v", "--export-manifest", pulledManifest). + ORAS("push", RegistryRef(ZOTHost, repo, tag), "--artifact-type", "test/artifact", foobar.FileLayerNames[0], foobar.FileLayerNames[1], foobar.FileLayerNames[2], "--export-manifest", pulledManifest). MatchStatus(foobar.FileStateKeys, true, 3). WithWorkDir(tempDir). WithDescription("push with manifest exported").Exec() @@ -45,7 +45,7 @@ var _ = Describe("OCI artifact users:", Ordered, func() { fetched := ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, tag)).Exec() MatchFile(filepath.Join(tempDir, pulledManifest), string(fetched.Out.Contents()), DefaultTimeout) - ORAS("pull", RegistryRef(ZOTHost, repo, tag), "-v", "-o", pullRoot). + ORAS("pull", RegistryRef(ZOTHost, repo, tag), "-o", pullRoot). MatchStatus(foobar.FileStateKeys, true, 3). WithWorkDir(tempDir). WithDescription("pull artFiles with config").Exec() @@ -59,7 +59,7 @@ var _ = Describe("OCI artifact users:", Ordered, func() { It("should attach and pull an artifact", func() { subject := RegistryRef(ZOTHost, repo, tag) - ORAS("attach", subject, "--artifact-type", "test/artifact1", fmt.Sprint(foobar.AttachFileName, ":", foobar.AttachFileMedia), "-v", "--export-manifest", pulledManifest). + ORAS("attach", subject, "--artifact-type", "test/artifact1", fmt.Sprint(foobar.AttachFileName, ":", foobar.AttachFileMedia), "--export-manifest", pulledManifest). MatchStatus([]match.StateKey{foobar.AttachFileStateKey}, true, 1). WithWorkDir(tempDir). WithDescription("attach with manifest exported").Exec() @@ -68,7 +68,7 @@ var _ = Describe("OCI artifact users:", Ordered, func() { fetched := ORAS("manifest", "fetch", ref).MatchKeyWords(foobar.AttachFileMedia).Exec() MatchFile(filepath.Join(tempDir, pulledManifest), string(fetched.Out.Contents()), DefaultTimeout) - ORAS("pull", ref, "-v", "-o", pullRoot). + ORAS("pull", ref, "-o", pullRoot). MatchStatus([]match.StateKey{foobar.AttachFileStateKey}, true, 1). WithWorkDir(tempDir). WithDescription("pull attached artifact").Exec() @@ -76,7 +76,7 @@ var _ = Describe("OCI artifact users:", Ordered, func() { WithWorkDir(tempDir). WithDescription("download identical file " + foobar.AttachFileName).Exec() - ORAS("attach", subject, "--artifact-type", "test/artifact2", fmt.Sprint(foobar.AttachFileName, ":", foobar.AttachFileMedia), "-v", "--export-manifest", pulledManifest). + ORAS("attach", subject, "--artifact-type", "test/artifact2", fmt.Sprint(foobar.AttachFileName, ":", foobar.AttachFileMedia), "--export-manifest", pulledManifest). MatchStatus([]match.StateKey{foobar.AttachFileStateKey}, true, 1). WithWorkDir(tempDir). WithDescription("attach again with manifest exported").Exec() @@ -85,7 +85,7 @@ var _ = Describe("OCI artifact users:", Ordered, func() { fetched = ORAS("manifest", "fetch", ref).MatchKeyWords(foobar.AttachFileMedia).Exec() MatchFile(filepath.Join(tempDir, pulledManifest), string(fetched.Out.Contents()), DefaultTimeout) - ORAS("pull", ref, "-v", "-o", pullRoot, "--include-subject"). + ORAS("pull", ref, "-o", pullRoot, "--include-subject"). MatchStatus(append(foobar.FileStateKeys, foobar.AttachFileStateKey), true, 4). WithWorkDir(tempDir). WithDescription("pull attached artifact and subject").Exec() diff --git a/test/e2e/suite/scenario/oci_image.go b/test/e2e/suite/scenario/oci_image.go index fed95c281..b60714dd8 100644 --- a/test/e2e/suite/scenario/oci_image.go +++ b/test/e2e/suite/scenario/oci_image.go @@ -36,7 +36,7 @@ var _ = Describe("OCI image user:", Ordered, func() { It("should push and pull an image", func() { manifestName := "packed.json" - ORAS("push", RegistryRef(Host, repo, tag), "--config", files[0], files[1], files[2], files[3], "-v", "--export-manifest", manifestName). + ORAS("push", RegistryRef(Host, repo, tag), "--config", files[0], files[1], files[2], files[3], "--export-manifest", manifestName). MatchStatus(statusKeys, true, 4). WithWorkDir(tempDir). WithDescription("push files with manifest exported").Exec() @@ -46,7 +46,7 @@ var _ = Describe("OCI image user:", Ordered, func() { MatchFile(filepath.Join(tempDir, manifestName), string(fetched), DefaultTimeout) pullRoot := "pulled" - ORAS("pull", RegistryRef(Host, repo, tag), "-v", "--config", files[0], "-o", pullRoot). + ORAS("pull", RegistryRef(Host, repo, tag), "--config", files[0], "-o", pullRoot). MatchStatus(statusKeys, true, 3). WithWorkDir(tempDir). WithDescription("pull files with config").Exec()