Skip to content

Commit

Permalink
update to the latest spec
Browse files Browse the repository at this point in the history
Signed-off-by: Shiwei Zhang <[email protected]>
  • Loading branch information
shizhMSFT committed Mar 31, 2021
1 parent 76586ec commit 1d4a86e
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cmd/oras/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/content/local"
"github.com/containerd/containerd/errdefs"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
Expand Down
7 changes: 2 additions & 5 deletions cmd/oras/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,8 @@ func runDiscover(opts discoverOptions) error {

fmt.Println("Discovered", len(artifacts), "artifacts referencing", opts.targetRef)
fmt.Println("Digest:", desc.Digest)
for _, artifact := range artifacts {
fmt.Println("Reference:", artifact.ArtifactType)
for _, blob := range artifact.Blobs {
fmt.Println("-", blob.Digest)
}
for digest := range artifacts {
fmt.Println("Reference:", digest)
}

return nil
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ go 1.16
replace (
// WARNING! Do NOT replace these without also replacing their lines in the `require` stanza below.
// These `replace` stanzas are IGNORED when this is imported as a library
github.com/containerd/containerd => github.com/notaryproject/containerd v1.5.0-beta.4.0.20210329094736-a683d692c2d3
github.com/containerd/containerd => github.com/notaryproject/containerd v1.5.0-beta.4.0.20210331082447-7f3d3544c4a1
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
github.com/docker/docker => github.com/moby/moby v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/opencontainers/artifacts => github.com/aviral26/artifacts v0.0.0-20210331072334-fac4f3a4da4e
)

require (
Expand All @@ -18,7 +19,7 @@ require (
github.com/docker/docker-credential-helpers v0.6.3 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/notaryproject/artifacts v0.0.0-20210325201627-49d06c9f1a07
github.com/opencontainers/artifacts v0.0.0-20210209205009-a282023000bd
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.1
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aviral26/artifacts v0.0.0-20210331072334-fac4f3a4da4e h1:PpLNjTpAp5mTxkuUdM2vCPckrXBPszurJQFvdFUaV1A=
github.com/aviral26/artifacts v0.0.0-20210331072334-fac4f3a4da4e/go.mod h1:IBQOjhxIKxb9G4h9NiWAJLGBgKPlIy27tcpPDTAfUQw=
github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down Expand Up @@ -370,10 +372,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8m
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/notaryproject/artifacts v0.0.0-20210325201627-49d06c9f1a07 h1:geJlhRFBwSJXhIv7KMgAXBz1Ie6wsuFeE5vuau3B4AQ=
github.com/notaryproject/artifacts v0.0.0-20210325201627-49d06c9f1a07/go.mod h1:za0DINIIQLPCBn9AhLfPjywgT51o0zll644gbIXiQiQ=
github.com/notaryproject/containerd v1.5.0-beta.4.0.20210329094736-a683d692c2d3 h1:lY6WLYzlPQkGkRCyoG/PPe7NmJNiiMHdrmeErbp64wA=
github.com/notaryproject/containerd v1.5.0-beta.4.0.20210329094736-a683d692c2d3/go.mod h1:uvn4m2BuoisfEj5I7GLoCJguWejxwLUlyM0L4XnVWY8=
github.com/notaryproject/containerd v1.5.0-beta.4.0.20210331082447-7f3d3544c4a1 h1:fclXC65oOW0xdy3Efk4bMAdh0F8r4cFX+KarSLt3zoI=
github.com/notaryproject/containerd v1.5.0-beta.4.0.20210331082447-7f3d3544c4a1/go.mod h1:rkfsydnYZBb6tU7iTyyTvQcoMXezKdDmX7+lEE1SyUg=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
4 changes: 2 additions & 2 deletions internal/resolver/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/remotes"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
Expand Down Expand Up @@ -54,7 +54,7 @@ func (r *dummyResolver) Pusher(ctx context.Context, ref string) (remotes.Pusher,

// Discoverer returns a new discoverer for the provided reference
func (r *dummyResolver) Discoverer(ctx context.Context, ref string) (remotes.Discoverer, error) {
return remotes.DiscovererFunc(func(ctx context.Context, desc ocispec.Descriptor, artifactType string) ([]artifactspec.Artifact, error) {
return remotes.DiscovererFunc(func(ctx context.Context, desc ocispec.Descriptor, artifactType string) (map[digest.Digest]artifactspec.Artifact, error) {
return nil, errors.Wrap(errdefs.ErrNotFound, "dummy resolver")
}), nil
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/oras/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"context"

"github.com/containerd/containerd/remotes"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

// Discover discovers artifacts referencing the specified artifact
func Discover(ctx context.Context, resolver remotes.Resolver, ref, artifactType string) (ocispec.Descriptor, []artifactspec.Artifact, error) {
func Discover(ctx context.Context, resolver remotes.Resolver, ref, artifactType string) (ocispec.Descriptor, map[digest.Digest]artifactspec.Artifact, error) {
_, desc, err := resolver.Resolve(ctx, ref)
if err != nil {
return ocispec.Descriptor{}, nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/oras/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/remotes"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"golang.org/x/sync/semaphore"
Expand Down
2 changes: 1 addition & 1 deletion pkg/oras/pull_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
orascontent "github.com/deislabs/oras/pkg/content"

"github.com/containerd/containerd/images"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/sync/semaphore"
Expand Down
2 changes: 1 addition & 1 deletion pkg/oras/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/remotes"
artifact "github.com/deislabs/oras/pkg/artifact"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
digest "github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
Expand Down
4 changes: 2 additions & 2 deletions pkg/oras/push_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
orascontent "github.com/deislabs/oras/pkg/content"

"github.com/containerd/containerd/images"
artifactspecs "github.com/notaryproject/artifacts/specs-go"
artifactspec "github.com/notaryproject/artifacts/specs-go/v2"
artifactspecs "github.com/opencontainers/artifacts/specs-go"
artifactspec "github.com/opencontainers/artifacts/specs-go/v2"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
Expand Down

0 comments on commit 1d4a86e

Please sign in to comment.