mirror of
https://github.com/containers/skopeo.git
synced 2025-10-23 12:09:06 +00:00
Update for docker-references PR and API changes
Pull in https://github.com/containers/image/pull/37 , and update for CanonicalDockerReference() returning a reference.Named
This commit is contained in:
27
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
27
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
@@ -25,13 +25,12 @@ func (e errFetchManifest) Error() string {
|
||||
|
||||
type dockerImageSource struct {
|
||||
ref reference.Named
|
||||
tag string
|
||||
c *dockerClient
|
||||
}
|
||||
|
||||
// newDockerImageSource is the same as NewImageSource, only it returns the more specific *dockerImageSource type.
|
||||
func newDockerImageSource(img, certPath string, tlsVerify bool) (*dockerImageSource, error) {
|
||||
ref, tag, err := parseImageName(img)
|
||||
ref, err := parseImageName(img)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -41,7 +40,6 @@ func newDockerImageSource(img, certPath string, tlsVerify bool) (*dockerImageSou
|
||||
}
|
||||
return &dockerImageSource{
|
||||
ref: ref,
|
||||
tag: tag,
|
||||
c: c,
|
||||
}, nil
|
||||
}
|
||||
@@ -51,11 +49,12 @@ func NewImageSource(img, certPath string, tlsVerify bool) (types.ImageSource, er
|
||||
return newDockerImageSource(img, certPath, tlsVerify)
|
||||
}
|
||||
|
||||
// IntendedDockerReference returns the full, unambiguous, Docker reference for this image, _as specified by the user_
|
||||
// (not as the image itself, or its underlying storage, claims). This can be used e.g. to determine which public keys are trusted for this image.
|
||||
// May be "" if unknown.
|
||||
func (s *dockerImageSource) IntendedDockerReference() string {
|
||||
return fmt.Sprintf("%s:%s", s.ref.Name(), s.tag)
|
||||
// IntendedDockerReference returns the Docker reference for this image, _as specified by the user_
|
||||
// (not as the image itself, or its underlying storage, claims). Should be fully expanded, i.e. !reference.IsNameOnly.
|
||||
// This can be used e.g. to determine which public keys are trusted for this image.
|
||||
// May be nil if unknown.
|
||||
func (s *dockerImageSource) IntendedDockerReference() reference.Named {
|
||||
return s.ref
|
||||
}
|
||||
|
||||
// simplifyContentType drops parameters from a HTTP media type (see https://tools.ietf.org/html/rfc7231#section-3.1.1.1)
|
||||
@@ -72,7 +71,11 @@ func simplifyContentType(contentType string) string {
|
||||
}
|
||||
|
||||
func (s *dockerImageSource) GetManifest(mimetypes []string) ([]byte, string, error) {
|
||||
url := fmt.Sprintf(manifestURL, s.ref.RemoteName(), s.tag)
|
||||
reference, err := tagOrDigest(s.ref)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
url := fmt.Sprintf(manifestURL, s.ref.RemoteName(), reference)
|
||||
// TODO(runcom) set manifest version header! schema1 for now - then schema2 etc etc and v1
|
||||
// TODO(runcom) NO, switch on the resulter manifest like Docker is doing
|
||||
headers := make(map[string][]string)
|
||||
@@ -123,7 +126,11 @@ func (s *dockerImageSource) Delete() error {
|
||||
headers := make(map[string][]string)
|
||||
headers["Accept"] = []string{manifest.DockerV2Schema2MIMEType}
|
||||
|
||||
getURL := fmt.Sprintf(manifestURL, s.ref.RemoteName(), s.tag)
|
||||
reference, err := tagOrDigest(s.ref)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
getURL := fmt.Sprintf(manifestURL, s.ref.RemoteName(), reference)
|
||||
get, err := s.c.makeRequest("GET", getURL, headers, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user