Skip to content

Commit

Permalink
chore: Remove last deprecated method (#1438)
Browse files Browse the repository at this point in the history
Signed-off-by: Terry Howe <[email protected]>
  • Loading branch information
Terry Howe authored Jul 3, 2024
1 parent 374a1e3 commit f649643
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 37 deletions.
33 changes: 0 additions & 33 deletions cmd/oras/internal/display/status/deprecated.go

This file was deleted.

7 changes: 5 additions & 2 deletions cmd/oras/root/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ import (
"oras.land/oras-go/v2/registry/remote/auth"
"oras.land/oras/cmd/oras/internal/argument"
"oras.land/oras/cmd/oras/internal/command"
"oras.land/oras/cmd/oras/internal/display/status"
"oras.land/oras/cmd/oras/internal/display/metadata/text"
"oras.land/oras/cmd/oras/internal/display/status/track"
oerrors "oras.land/oras/cmd/oras/internal/errors"
"oras.land/oras/cmd/oras/internal/option"
"oras.land/oras/cmd/oras/internal/output"
"oras.land/oras/internal/docker"
"oras.land/oras/internal/graph"
"oras.land/oras/internal/listener"
"oras.land/oras/internal/registryutil"
)

Expand Down Expand Up @@ -141,7 +142,9 @@ func runCopy(cmd *cobra.Command, opts *copyOptions) error {
if len(opts.extraRefs) != 0 {
tagNOpts := oras.DefaultTagNOptions
tagNOpts.Concurrency = opts.concurrency
if _, err = oras.TagN(ctx, status.NewTagStatusPrinter(opts.Printer, dst), opts.To.Reference, opts.extraRefs, tagNOpts); err != nil {
tagHandler := text.NewTagHandler(opts.Printer, "")
tagListener := listener.NewTagListener(dst, nil, tagHandler.OnTagged)
if _, err = oras.TagN(ctx, tagListener, opts.To.Reference, opts.extraRefs, tagNOpts); err != nil {
return err
}
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/oras/root/manifest/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ import (
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras/cmd/oras/internal/argument"
"oras.land/oras/cmd/oras/internal/command"
"oras.land/oras/cmd/oras/internal/display/status"
"oras.land/oras/cmd/oras/internal/display/metadata/text"
oerrors "oras.land/oras/cmd/oras/internal/errors"
"oras.land/oras/cmd/oras/internal/manifest"
"oras.land/oras/cmd/oras/internal/option"
"oras.land/oras/internal/file"
"oras.land/oras/internal/listener"
)

type pushOptions struct {
Expand Down Expand Up @@ -189,7 +190,9 @@ func pushManifest(cmd *cobra.Command, opts pushOptions) error {
}
_ = opts.Println("Pushed", opts.AnnotatedReference())
if len(opts.extraRefs) != 0 {
if _, err = oras.TagBytesN(ctx, status.NewTagStatusPrinter(opts.Printer, target), mediaType, contentBytes, opts.extraRefs, tagBytesNOpts); err != nil {
tagHandler := text.NewTagHandler(opts.Printer, "")
tagListener := listener.NewTagListener(target, nil, tagHandler.OnTagged)
if _, err = oras.TagBytesN(ctx, tagListener, mediaType, contentBytes, opts.extraRefs, tagBytesNOpts); err != nil {
return err
}
}
Expand Down
13 changes: 13 additions & 0 deletions test/e2e/suite/command/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,19 @@ var _ = Describe("1.1 registry users:", func() {
WithInput(strings.NewReader(manifest)).Exec()
})

It("should push a manifest and add multiple tags to it", func() {
repo := fmt.Sprintf(repoFmt, "push", "multi-tags")
CopyZOTRepo(ImageRepo, repo)
// test
ORAS("manifest", "push", fmt.Sprintf("%s,t2,t3", RegistryRef(ZOTHost, repo, "t1")), "-").
WithInput(strings.NewReader(manifest)).
Exec()
// verify
ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, "t1")).Exec()
ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, "t2")).Exec()
ORAS("manifest", "fetch", RegistryRef(ZOTHost, repo, "t3")).Exec()
})

It("should push a manifest from file", func() {
manifestPath := WriteTempFile("manifest.json", manifest)
tag := "from-file"
Expand Down

0 comments on commit f649643

Please sign in to comment.