mirror of
https://github.com/containers/skopeo.git
synced 2025-07-17 16:21:40 +00:00
finally fix master
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
38cb7a9d27
commit
3d25e18181
@ -10,7 +10,7 @@ clone git github.com/Sirupsen/logrus v0.8.7 # logrus is a common dependency amon
|
|||||||
clone git github.com/docker/docker master
|
clone git github.com/docker/docker master
|
||||||
clone git golang.org/x/net master https://github.com/golang/net.git
|
clone git golang.org/x/net master https://github.com/golang/net.git
|
||||||
clone git github.com/docker/engine-api master
|
clone git github.com/docker/engine-api master
|
||||||
clone git github.com/docker/distribution master
|
clone git github.com/docker/distribution v2.3.0-rc.1
|
||||||
clone git github.com/docker/go-connections master
|
clone git github.com/docker/go-connections master
|
||||||
clone git github.com/docker/go-units master
|
clone git github.com/docker/go-units master
|
||||||
clone git github.com/docker/libtrust master
|
clone git github.com/docker/libtrust master
|
||||||
|
21
vendor/github.com/docker/distribution/manifest/schema1/config_builder.go
generated
vendored
21
vendor/github.com/docker/distribution/manifest/schema1/config_builder.go
generated
vendored
@ -9,7 +9,6 @@ import (
|
|||||||
|
|
||||||
"github.com/docker/distribution"
|
"github.com/docker/distribution"
|
||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
"github.com/docker/distribution/reference"
|
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
|
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
@ -40,8 +39,10 @@ type configManifestBuilder struct {
|
|||||||
// configJSON is configuration supplied when the ManifestBuilder was
|
// configJSON is configuration supplied when the ManifestBuilder was
|
||||||
// created.
|
// created.
|
||||||
configJSON []byte
|
configJSON []byte
|
||||||
// ref contains the name and optional tag provided to NewConfigManifestBuilder.
|
// name is the name provided to NewConfigManifestBuilder
|
||||||
ref reference.Named
|
name string
|
||||||
|
// tag is the tag provided to NewConfigManifestBuilder
|
||||||
|
tag string
|
||||||
// descriptors is the set of descriptors referencing the layers.
|
// descriptors is the set of descriptors referencing the layers.
|
||||||
descriptors []distribution.Descriptor
|
descriptors []distribution.Descriptor
|
||||||
// emptyTarDigest is set to a valid digest if an empty tar has been
|
// emptyTarDigest is set to a valid digest if an empty tar has been
|
||||||
@ -53,12 +54,13 @@ type configManifestBuilder struct {
|
|||||||
// schema version from an image configuration and a set of descriptors.
|
// schema version from an image configuration and a set of descriptors.
|
||||||
// It takes a BlobService so that it can add an empty tar to the blob store
|
// It takes a BlobService so that it can add an empty tar to the blob store
|
||||||
// if the resulting manifest needs empty layers.
|
// if the resulting manifest needs empty layers.
|
||||||
func NewConfigManifestBuilder(bs distribution.BlobService, pk libtrust.PrivateKey, ref reference.Named, configJSON []byte) distribution.ManifestBuilder {
|
func NewConfigManifestBuilder(bs distribution.BlobService, pk libtrust.PrivateKey, name, tag string, configJSON []byte) distribution.ManifestBuilder {
|
||||||
return &configManifestBuilder{
|
return &configManifestBuilder{
|
||||||
bs: bs,
|
bs: bs,
|
||||||
pk: pk,
|
pk: pk,
|
||||||
configJSON: configJSON,
|
configJSON: configJSON,
|
||||||
ref: ref,
|
name: name,
|
||||||
|
tag: tag,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,17 +190,12 @@ func (mb *configManifestBuilder) Build(ctx context.Context) (m distribution.Mani
|
|||||||
|
|
||||||
history[0].V1Compatibility = string(transformedConfig)
|
history[0].V1Compatibility = string(transformedConfig)
|
||||||
|
|
||||||
tag := ""
|
|
||||||
if tagged, isTagged := mb.ref.(reference.Tagged); isTagged {
|
|
||||||
tag = tagged.Tag()
|
|
||||||
}
|
|
||||||
|
|
||||||
mfst := Manifest{
|
mfst := Manifest{
|
||||||
Versioned: manifest.Versioned{
|
Versioned: manifest.Versioned{
|
||||||
SchemaVersion: 1,
|
SchemaVersion: 1,
|
||||||
},
|
},
|
||||||
Name: mb.ref.Name(),
|
Name: mb.name,
|
||||||
Tag: tag,
|
Tag: mb.tag,
|
||||||
Architecture: img.Architecture,
|
Architecture: img.Architecture,
|
||||||
FSLayers: fsLayerList,
|
FSLayers: fsLayerList,
|
||||||
History: history,
|
History: history,
|
||||||
|
10
vendor/github.com/docker/distribution/manifest/schema1/reference_builder.go
generated
vendored
10
vendor/github.com/docker/distribution/manifest/schema1/reference_builder.go
generated
vendored
@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
"github.com/docker/distribution/manifest"
|
"github.com/docker/distribution/manifest"
|
||||||
"github.com/docker/distribution/reference"
|
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,18 +20,13 @@ type referenceManifestBuilder struct {
|
|||||||
|
|
||||||
// NewReferenceManifestBuilder is used to build new manifests for the current
|
// NewReferenceManifestBuilder is used to build new manifests for the current
|
||||||
// schema version using schema1 dependencies.
|
// schema version using schema1 dependencies.
|
||||||
func NewReferenceManifestBuilder(pk libtrust.PrivateKey, ref reference.Named, architecture string) distribution.ManifestBuilder {
|
func NewReferenceManifestBuilder(pk libtrust.PrivateKey, name, tag, architecture string) distribution.ManifestBuilder {
|
||||||
tag := ""
|
|
||||||
if tagged, isTagged := ref.(reference.Tagged); isTagged {
|
|
||||||
tag = tagged.Tag()
|
|
||||||
}
|
|
||||||
|
|
||||||
return &referenceManifestBuilder{
|
return &referenceManifestBuilder{
|
||||||
Manifest: Manifest{
|
Manifest: Manifest{
|
||||||
Versioned: manifest.Versioned{
|
Versioned: manifest.Versioned{
|
||||||
SchemaVersion: 1,
|
SchemaVersion: 1,
|
||||||
},
|
},
|
||||||
Name: ref.Name(),
|
Name: name,
|
||||||
Tag: tag,
|
Tag: tag,
|
||||||
Architecture: architecture,
|
Architecture: architecture,
|
||||||
},
|
},
|
||||||
|
20
vendor/github.com/docker/distribution/manifests.go
generated
vendored
20
vendor/github.com/docker/distribution/manifests.go
generated
vendored
@ -2,7 +2,7 @@ package distribution
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"mime"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
"github.com/docker/distribution/digest"
|
"github.com/docker/distribution/digest"
|
||||||
@ -84,23 +84,19 @@ var mappings = make(map[string]UnmarshalFunc, 0)
|
|||||||
// UnmarshalManifest looks up manifest unmarshall functions based on
|
// UnmarshalManifest looks up manifest unmarshall functions based on
|
||||||
// MediaType
|
// MediaType
|
||||||
func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
|
func UnmarshalManifest(ctHeader string, p []byte) (Manifest, Descriptor, error) {
|
||||||
// Need to look up by the actual media type, not the raw contents of
|
// Need to look up by the actual content type, not the raw contents of
|
||||||
// the header. Strip semicolons and anything following them.
|
// the header. Strip semicolons and anything following them.
|
||||||
var mediatype string
|
var mediatype string
|
||||||
if ctHeader != "" {
|
semicolonIndex := strings.Index(ctHeader, ";")
|
||||||
var err error
|
if semicolonIndex != -1 {
|
||||||
mediatype, _, err = mime.ParseMediaType(ctHeader)
|
mediatype = ctHeader[:semicolonIndex]
|
||||||
if err != nil {
|
} else {
|
||||||
return nil, Descriptor{}, err
|
mediatype = ctHeader
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unmarshalFunc, ok := mappings[mediatype]
|
unmarshalFunc, ok := mappings[mediatype]
|
||||||
if !ok {
|
if !ok {
|
||||||
unmarshalFunc, ok = mappings[""]
|
return nil, Descriptor{}, fmt.Errorf("unsupported manifest mediatype: %s", mediatype)
|
||||||
if !ok {
|
|
||||||
return nil, Descriptor{}, fmt.Errorf("unsupported manifest mediatype and no default available: %s", mediatype)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return unmarshalFunc(p)
|
return unmarshalFunc(p)
|
||||||
|
5
vendor/github.com/docker/distribution/registry.go
generated
vendored
5
vendor/github.com/docker/distribution/registry.go
generated
vendored
@ -2,7 +2,6 @@ package distribution
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
"github.com/docker/distribution/reference"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Scope defines the set of items that match a namespace.
|
// Scope defines the set of items that match a namespace.
|
||||||
@ -33,7 +32,7 @@ type Namespace interface {
|
|||||||
// Repository should return a reference to the named repository. The
|
// Repository should return a reference to the named repository. The
|
||||||
// registry may or may not have the repository but should always return a
|
// registry may or may not have the repository but should always return a
|
||||||
// reference.
|
// reference.
|
||||||
Repository(ctx context.Context, name reference.Named) (Repository, error)
|
Repository(ctx context.Context, name string) (Repository, error)
|
||||||
|
|
||||||
// Repositories fills 'repos' with a lexigraphically sorted catalog of repositories
|
// Repositories fills 'repos' with a lexigraphically sorted catalog of repositories
|
||||||
// up to the size of 'repos' and returns the value 'n' for the number of entries
|
// up to the size of 'repos' and returns the value 'n' for the number of entries
|
||||||
@ -50,7 +49,7 @@ type ManifestServiceOption interface {
|
|||||||
// Repository is a named collection of manifests and layers.
|
// Repository is a named collection of manifests and layers.
|
||||||
type Repository interface {
|
type Repository interface {
|
||||||
// Name returns the name of the repository.
|
// Name returns the name of the repository.
|
||||||
Name() reference.Named
|
Name() string
|
||||||
|
|
||||||
// Manifests returns a reference to this repository's manifest service.
|
// Manifests returns a reference to this repository's manifest service.
|
||||||
// with the supplied options applied.
|
// with the supplied options applied.
|
||||||
|
30
vendor/github.com/docker/distribution/registry/api/v2/urls.go
generated
vendored
30
vendor/github.com/docker/distribution/registry/api/v2/urls.go
generated
vendored
@ -5,7 +5,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/distribution/reference"
|
"github.com/docker/distribution/digest"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -113,10 +113,10 @@ func (ub *URLBuilder) BuildCatalogURL(values ...url.Values) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildTagsURL constructs a url to list the tags in the named repository.
|
// BuildTagsURL constructs a url to list the tags in the named repository.
|
||||||
func (ub *URLBuilder) BuildTagsURL(name reference.Named) (string, error) {
|
func (ub *URLBuilder) BuildTagsURL(name string) (string, error) {
|
||||||
route := ub.cloneRoute(RouteNameTags)
|
route := ub.cloneRoute(RouteNameTags)
|
||||||
|
|
||||||
tagsURL, err := route.URL("name", name.Name())
|
tagsURL, err := route.URL("name", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -126,18 +126,10 @@ func (ub *URLBuilder) BuildTagsURL(name reference.Named) (string, error) {
|
|||||||
|
|
||||||
// BuildManifestURL constructs a url for the manifest identified by name and
|
// BuildManifestURL constructs a url for the manifest identified by name and
|
||||||
// reference. The argument reference may be either a tag or digest.
|
// reference. The argument reference may be either a tag or digest.
|
||||||
func (ub *URLBuilder) BuildManifestURL(ref reference.Named) (string, error) {
|
func (ub *URLBuilder) BuildManifestURL(name, reference string) (string, error) {
|
||||||
route := ub.cloneRoute(RouteNameManifest)
|
route := ub.cloneRoute(RouteNameManifest)
|
||||||
|
|
||||||
tagOrDigest := ""
|
manifestURL, err := route.URL("name", name, "reference", reference)
|
||||||
switch v := ref.(type) {
|
|
||||||
case reference.Tagged:
|
|
||||||
tagOrDigest = v.Tag()
|
|
||||||
case reference.Digested:
|
|
||||||
tagOrDigest = v.Digest().String()
|
|
||||||
}
|
|
||||||
|
|
||||||
manifestURL, err := route.URL("name", ref.Name(), "reference", tagOrDigest)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -146,10 +138,10 @@ func (ub *URLBuilder) BuildManifestURL(ref reference.Named) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildBlobURL constructs the url for the blob identified by name and dgst.
|
// BuildBlobURL constructs the url for the blob identified by name and dgst.
|
||||||
func (ub *URLBuilder) BuildBlobURL(ref reference.Canonical) (string, error) {
|
func (ub *URLBuilder) BuildBlobURL(name string, dgst digest.Digest) (string, error) {
|
||||||
route := ub.cloneRoute(RouteNameBlob)
|
route := ub.cloneRoute(RouteNameBlob)
|
||||||
|
|
||||||
layerURL, err := route.URL("name", ref.Name(), "digest", ref.Digest().String())
|
layerURL, err := route.URL("name", name, "digest", dgst.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -159,10 +151,10 @@ func (ub *URLBuilder) BuildBlobURL(ref reference.Canonical) (string, error) {
|
|||||||
|
|
||||||
// BuildBlobUploadURL constructs a url to begin a blob upload in the
|
// BuildBlobUploadURL constructs a url to begin a blob upload in the
|
||||||
// repository identified by name.
|
// repository identified by name.
|
||||||
func (ub *URLBuilder) BuildBlobUploadURL(name reference.Named, values ...url.Values) (string, error) {
|
func (ub *URLBuilder) BuildBlobUploadURL(name string, values ...url.Values) (string, error) {
|
||||||
route := ub.cloneRoute(RouteNameBlobUpload)
|
route := ub.cloneRoute(RouteNameBlobUpload)
|
||||||
|
|
||||||
uploadURL, err := route.URL("name", name.Name())
|
uploadURL, err := route.URL("name", name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -174,10 +166,10 @@ func (ub *URLBuilder) BuildBlobUploadURL(name reference.Named, values ...url.Val
|
|||||||
// including any url values. This should generally not be used by clients, as
|
// including any url values. This should generally not be used by clients, as
|
||||||
// this url is provided by server implementations during the blob upload
|
// this url is provided by server implementations during the blob upload
|
||||||
// process.
|
// process.
|
||||||
func (ub *URLBuilder) BuildBlobUploadChunkURL(name reference.Named, uuid string, values ...url.Values) (string, error) {
|
func (ub *URLBuilder) BuildBlobUploadChunkURL(name, uuid string, values ...url.Values) (string, error) {
|
||||||
route := ub.cloneRoute(RouteNameBlobUploadChunk)
|
route := ub.cloneRoute(RouteNameBlobUploadChunk)
|
||||||
|
|
||||||
uploadURL, err := route.URL("name", name.Name(), "uuid", uuid)
|
uploadURL, err := route.URL("name", name, "uuid", uuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
99
vendor/github.com/docker/distribution/registry/client/repository.go
generated
vendored
99
vendor/github.com/docker/distribution/registry/client/repository.go
generated
vendored
@ -98,7 +98,11 @@ func (r *registry) Repositories(ctx context.Context, entries []string, last stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRepository creates a new Repository for the given repository name and base URL.
|
// NewRepository creates a new Repository for the given repository name and base URL.
|
||||||
func NewRepository(ctx context.Context, name reference.Named, baseURL string, transport http.RoundTripper) (distribution.Repository, error) {
|
func NewRepository(ctx context.Context, name, baseURL string, transport http.RoundTripper) (distribution.Repository, error) {
|
||||||
|
if _, err := reference.ParseNamed(name); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
ub, err := v2.NewURLBuilderFromString(baseURL)
|
ub, err := v2.NewURLBuilderFromString(baseURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -121,21 +125,21 @@ type repository struct {
|
|||||||
client *http.Client
|
client *http.Client
|
||||||
ub *v2.URLBuilder
|
ub *v2.URLBuilder
|
||||||
context context.Context
|
context context.Context
|
||||||
name reference.Named
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repository) Name() reference.Named {
|
func (r *repository) Name() string {
|
||||||
return r.name
|
return r.name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repository) Blobs(ctx context.Context) distribution.BlobStore {
|
func (r *repository) Blobs(ctx context.Context) distribution.BlobStore {
|
||||||
statter := &blobStatter{
|
statter := &blobStatter{
|
||||||
name: r.name,
|
name: r.Name(),
|
||||||
ub: r.ub,
|
ub: r.ub,
|
||||||
client: r.client,
|
client: r.client,
|
||||||
}
|
}
|
||||||
return &blobs{
|
return &blobs{
|
||||||
name: r.name,
|
name: r.Name(),
|
||||||
ub: r.ub,
|
ub: r.ub,
|
||||||
client: r.client,
|
client: r.client,
|
||||||
statter: cache.NewCachedBlobStatter(memory.NewInMemoryBlobDescriptorCacheProvider(), statter),
|
statter: cache.NewCachedBlobStatter(memory.NewInMemoryBlobDescriptorCacheProvider(), statter),
|
||||||
@ -145,7 +149,7 @@ func (r *repository) Blobs(ctx context.Context) distribution.BlobStore {
|
|||||||
func (r *repository) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
|
func (r *repository) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
|
||||||
// todo(richardscothern): options should be sent over the wire
|
// todo(richardscothern): options should be sent over the wire
|
||||||
return &manifests{
|
return &manifests{
|
||||||
name: r.name,
|
name: r.Name(),
|
||||||
ub: r.ub,
|
ub: r.ub,
|
||||||
client: r.client,
|
client: r.client,
|
||||||
etags: make(map[string]string),
|
etags: make(map[string]string),
|
||||||
@ -166,7 +170,7 @@ type tags struct {
|
|||||||
client *http.Client
|
client *http.Client
|
||||||
ub *v2.URLBuilder
|
ub *v2.URLBuilder
|
||||||
context context.Context
|
context context.Context
|
||||||
name reference.Named
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
// All returns all tags
|
// All returns all tags
|
||||||
@ -249,11 +253,7 @@ func descriptorFromResponse(response *http.Response) (distribution.Descriptor, e
|
|||||||
// to construct a descriptor for the tag. If the registry doesn't support HEADing
|
// to construct a descriptor for the tag. If the registry doesn't support HEADing
|
||||||
// a manifest, fallback to GET.
|
// a manifest, fallback to GET.
|
||||||
func (t *tags) Get(ctx context.Context, tag string) (distribution.Descriptor, error) {
|
func (t *tags) Get(ctx context.Context, tag string) (distribution.Descriptor, error) {
|
||||||
ref, err := reference.WithTag(t.name, tag)
|
u, err := t.ub.BuildManifestURL(t.name, tag)
|
||||||
if err != nil {
|
|
||||||
return distribution.Descriptor{}, err
|
|
||||||
}
|
|
||||||
u, err := t.ub.BuildManifestURL(ref)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return distribution.Descriptor{}, err
|
return distribution.Descriptor{}, err
|
||||||
}
|
}
|
||||||
@ -293,18 +293,14 @@ func (t *tags) Untag(ctx context.Context, tag string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type manifests struct {
|
type manifests struct {
|
||||||
name reference.Named
|
name string
|
||||||
ub *v2.URLBuilder
|
ub *v2.URLBuilder
|
||||||
client *http.Client
|
client *http.Client
|
||||||
etags map[string]string
|
etags map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *manifests) Exists(ctx context.Context, dgst digest.Digest) (bool, error) {
|
func (ms *manifests) Exists(ctx context.Context, dgst digest.Digest) (bool, error) {
|
||||||
ref, err := reference.WithDigest(ms.name, dgst)
|
u, err := ms.ub.BuildManifestURL(ms.name, dgst.String())
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
u, err := ms.ub.BuildManifestURL(ref)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -341,19 +337,11 @@ func (o etagOption) Apply(ms distribution.ManifestService) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ms *manifests) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error) {
|
func (ms *manifests) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error) {
|
||||||
var (
|
|
||||||
digestOrTag string
|
|
||||||
ref reference.Named
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
|
var tag string
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
if opt, ok := option.(withTagOption); ok {
|
if opt, ok := option.(withTagOption); ok {
|
||||||
digestOrTag = opt.tag
|
tag = opt.tag
|
||||||
ref, err = reference.WithTag(ms.name, opt.tag)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
err := option.Apply(ms)
|
err := option.Apply(ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -362,15 +350,14 @@ func (ms *manifests) Get(ctx context.Context, dgst digest.Digest, options ...dis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if digestOrTag == "" {
|
var ref string
|
||||||
digestOrTag = dgst.String()
|
if tag != "" {
|
||||||
ref, err = reference.WithDigest(ms.name, dgst)
|
ref = tag
|
||||||
if err != nil {
|
} else {
|
||||||
return nil, err
|
ref = dgst.String()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := ms.ub.BuildManifestURL(ref)
|
u, err := ms.ub.BuildManifestURL(ms.name, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -384,8 +371,8 @@ func (ms *manifests) Get(ctx context.Context, dgst digest.Digest, options ...dis
|
|||||||
req.Header.Add("Accept", t)
|
req.Header.Add("Accept", t)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := ms.etags[digestOrTag]; ok {
|
if _, ok := ms.etags[ref]; ok {
|
||||||
req.Header.Set("If-None-Match", ms.etags[digestOrTag])
|
req.Header.Set("If-None-Match", ms.etags[ref])
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := ms.client.Do(req)
|
resp, err := ms.client.Do(req)
|
||||||
@ -429,15 +416,11 @@ func (o withTagOption) Apply(m distribution.ManifestService) error {
|
|||||||
// Put puts a manifest. A tag can be specified using an options parameter which uses some shared state to hold the
|
// Put puts a manifest. A tag can be specified using an options parameter which uses some shared state to hold the
|
||||||
// tag name in order to build the correct upload URL. This state is written and read under a lock.
|
// tag name in order to build the correct upload URL. This state is written and read under a lock.
|
||||||
func (ms *manifests) Put(ctx context.Context, m distribution.Manifest, options ...distribution.ManifestServiceOption) (digest.Digest, error) {
|
func (ms *manifests) Put(ctx context.Context, m distribution.Manifest, options ...distribution.ManifestServiceOption) (digest.Digest, error) {
|
||||||
ref := ms.name
|
var tag string
|
||||||
|
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
if opt, ok := option.(withTagOption); ok {
|
if opt, ok := option.(withTagOption); ok {
|
||||||
var err error
|
tag = opt.tag
|
||||||
ref, err = reference.WithTag(ref, opt.tag)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
err := option.Apply(ms)
|
err := option.Apply(ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -446,7 +429,7 @@ func (ms *manifests) Put(ctx context.Context, m distribution.Manifest, options .
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
manifestURL, err := ms.ub.BuildManifestURL(ref)
|
manifestURL, err := ms.ub.BuildManifestURL(ms.name, tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -483,11 +466,7 @@ func (ms *manifests) Put(ctx context.Context, m distribution.Manifest, options .
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ms *manifests) Delete(ctx context.Context, dgst digest.Digest) error {
|
func (ms *manifests) Delete(ctx context.Context, dgst digest.Digest) error {
|
||||||
ref, err := reference.WithDigest(ms.name, dgst)
|
u, err := ms.ub.BuildManifestURL(ms.name, dgst.String())
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
u, err := ms.ub.BuildManifestURL(ref)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -514,7 +493,7 @@ func (ms *manifests) Delete(ctx context.Context, dgst digest.Digest) error {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
type blobs struct {
|
type blobs struct {
|
||||||
name reference.Named
|
name string
|
||||||
ub *v2.URLBuilder
|
ub *v2.URLBuilder
|
||||||
client *http.Client
|
client *http.Client
|
||||||
|
|
||||||
@ -552,11 +531,7 @@ func (bs *blobs) Get(ctx context.Context, dgst digest.Digest) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bs *blobs) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error) {
|
func (bs *blobs) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error) {
|
||||||
ref, err := reference.WithDigest(bs.name, dgst)
|
blobURL, err := bs.ub.BuildBlobURL(bs.name, dgst)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
blobURL, err := bs.ub.BuildBlobURL(ref)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -691,17 +666,13 @@ func (bs *blobs) Delete(ctx context.Context, dgst digest.Digest) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type blobStatter struct {
|
type blobStatter struct {
|
||||||
name reference.Named
|
name string
|
||||||
ub *v2.URLBuilder
|
ub *v2.URLBuilder
|
||||||
client *http.Client
|
client *http.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *blobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
|
func (bs *blobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
|
||||||
ref, err := reference.WithDigest(bs.name, dgst)
|
u, err := bs.ub.BuildBlobURL(bs.name, dgst)
|
||||||
if err != nil {
|
|
||||||
return distribution.Descriptor{}, err
|
|
||||||
}
|
|
||||||
u, err := bs.ub.BuildBlobURL(ref)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return distribution.Descriptor{}, err
|
return distribution.Descriptor{}, err
|
||||||
}
|
}
|
||||||
@ -749,11 +720,7 @@ func buildCatalogValues(maxEntries int, last string) url.Values {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bs *blobStatter) Clear(ctx context.Context, dgst digest.Digest) error {
|
func (bs *blobStatter) Clear(ctx context.Context, dgst digest.Digest) error {
|
||||||
ref, err := reference.WithDigest(bs.name, dgst)
|
blobURL, err := bs.ub.BuildBlobURL(bs.name, dgst)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
blobURL, err := bs.ub.BuildBlobURL(ref)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user