mirror of
https://github.com/containers/skopeo.git
synced 2025-08-22 16:26:00 +00:00
Merge pull request #403 from owtaylor/requested-manifest-mime-types
Update for removal of requestedMIMETypes from ImageReference.NewImageSource()
This commit is contained in:
commit
55e7b079f1
@ -8,7 +8,6 @@ import (
|
|||||||
|
|
||||||
"github.com/containers/image/directory"
|
"github.com/containers/image/directory"
|
||||||
"github.com/containers/image/image"
|
"github.com/containers/image/image"
|
||||||
"github.com/containers/image/manifest"
|
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -25,12 +24,7 @@ var layersCmd = cli.Command{
|
|||||||
if c.NArg() == 0 {
|
if c.NArg() == 0 {
|
||||||
return errors.New("Usage: layers imageReference [layer...]")
|
return errors.New("Usage: layers imageReference [layer...]")
|
||||||
}
|
}
|
||||||
rawSource, err := parseImageSource(c, c.Args()[0], []string{
|
rawSource, err := parseImageSource(c, c.Args()[0])
|
||||||
// TODO: skopeo layers only supports these now
|
|
||||||
// eventually we'll remove this command altogether...
|
|
||||||
manifest.DockerV2Schema1SignedMediaType,
|
|
||||||
manifest.DockerV2Schema1MediaType,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -72,9 +72,8 @@ func parseImage(c *cli.Context) (types.Image, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parseImageSource converts image URL-like string to an ImageSource.
|
// parseImageSource converts image URL-like string to an ImageSource.
|
||||||
// requestedManifestMIMETypes is as in types.ImageReference.NewImageSource.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func parseImageSource(c *cli.Context, name string, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func parseImageSource(c *cli.Context, name string) (types.ImageSource, error) {
|
||||||
ref, err := alltransports.ParseImageName(name)
|
ref, err := alltransports.ParseImageName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -83,5 +82,5 @@ func parseImageSource(c *cli.Context, name string, requestedManifestMIMETypes []
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ref.NewImageSource(ctx, requestedManifestMIMETypes)
|
return ref.NewImageSource(ctx)
|
||||||
}
|
}
|
||||||
|
6
vendor/github.com/containers/image/copy/copy.go
generated
vendored
6
vendor/github.com/containers/image/copy/copy.go
generated
vendored
@ -129,9 +129,7 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
destSupportedManifestMIMETypes := dest.SupportedManifestMIMETypes()
|
rawSource, err := srcRef.NewImageSource(options.SourceCtx)
|
||||||
|
|
||||||
rawSource, err := srcRef.NewImageSource(options.SourceCtx, destSupportedManifestMIMETypes)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Error initializing source %s", transports.ImageName(srcRef))
|
return errors.Wrapf(err, "Error initializing source %s", transports.ImageName(srcRef))
|
||||||
}
|
}
|
||||||
@ -195,7 +193,7 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe
|
|||||||
|
|
||||||
// We compute preferredManifestMIMEType only to show it in error messages.
|
// We compute preferredManifestMIMEType only to show it in error messages.
|
||||||
// Without having to add this context in an error message, we would be happy enough to know only that no conversion is needed.
|
// Without having to add this context in an error message, we would be happy enough to know only that no conversion is needed.
|
||||||
preferredManifestMIMEType, otherManifestMIMETypeCandidates, err := determineManifestConversion(&manifestUpdates, src, destSupportedManifestMIMETypes, canModifyManifest)
|
preferredManifestMIMEType, otherManifestMIMETypeCandidates, err := determineManifestConversion(&manifestUpdates, src, dest.SupportedManifestMIMETypes(), canModifyManifest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
6
vendor/github.com/containers/image/directory/directory_transport.go
generated
vendored
6
vendor/github.com/containers/image/directory/directory_transport.go
generated
vendored
@ -143,11 +143,9 @@ func (ref dirReference) NewImage(ctx *types.SystemContext) (types.Image, error)
|
|||||||
return image.FromSource(src)
|
return image.FromSource(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref dirReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref dirReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ref), nil
|
return newImageSource(ref), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
vendor/github.com/containers/image/docker/archive/transport.go
generated
vendored
6
vendor/github.com/containers/image/docker/archive/transport.go
generated
vendored
@ -134,11 +134,9 @@ func (ref archiveReference) NewImage(ctx *types.SystemContext) (types.Image, err
|
|||||||
return ctrImage.FromSource(src)
|
return ctrImage.FromSource(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref archiveReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref archiveReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref), nil
|
return newImageSource(ctx, ref), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
vendor/github.com/containers/image/docker/daemon/daemon_transport.go
generated
vendored
6
vendor/github.com/containers/image/docker/daemon/daemon_transport.go
generated
vendored
@ -161,11 +161,9 @@ func (ref daemonReference) NewImage(ctx *types.SystemContext) (types.Image, erro
|
|||||||
return image.FromSource(src)
|
return image.FromSource(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref daemonReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref daemonReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref)
|
return newImageSource(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
vendor/github.com/containers/image/docker/docker_image.go
generated
vendored
2
vendor/github.com/containers/image/docker/docker_image.go
generated
vendored
@ -23,7 +23,7 @@ type Image struct {
|
|||||||
// a client to the registry hosting the given image.
|
// a client to the registry hosting the given image.
|
||||||
// The caller must call .Close() on the returned Image.
|
// The caller must call .Close() on the returned Image.
|
||||||
func newImage(ctx *types.SystemContext, ref dockerReference) (types.Image, error) {
|
func newImage(ctx *types.SystemContext, ref dockerReference) (types.Image, error) {
|
||||||
s, err := newImageSource(ctx, ref, nil)
|
s, err := newImageSource(ctx, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
23
vendor/github.com/containers/image/docker/docker_image_dest.go
generated
vendored
23
vendor/github.com/containers/image/docker/docker_image_dest.go
generated
vendored
@ -20,25 +20,11 @@ import (
|
|||||||
"github.com/docker/distribution/registry/api/v2"
|
"github.com/docker/distribution/registry/api/v2"
|
||||||
"github.com/docker/distribution/registry/client"
|
"github.com/docker/distribution/registry/client"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
|
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var manifestMIMETypes = []string{
|
|
||||||
// TODO(runcom): we'll add OCI as part of another PR here
|
|
||||||
manifest.DockerV2Schema2MediaType,
|
|
||||||
manifest.DockerV2Schema1SignedMediaType,
|
|
||||||
manifest.DockerV2Schema1MediaType,
|
|
||||||
}
|
|
||||||
|
|
||||||
func supportedManifestMIMETypesMap() map[string]bool {
|
|
||||||
m := make(map[string]bool, len(manifestMIMETypes))
|
|
||||||
for _, mt := range manifestMIMETypes {
|
|
||||||
m[mt] = true
|
|
||||||
}
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|
||||||
type dockerImageDestination struct {
|
type dockerImageDestination struct {
|
||||||
ref dockerReference
|
ref dockerReference
|
||||||
c *dockerClient
|
c *dockerClient
|
||||||
@ -70,7 +56,12 @@ func (d *dockerImageDestination) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *dockerImageDestination) SupportedManifestMIMETypes() []string {
|
func (d *dockerImageDestination) SupportedManifestMIMETypes() []string {
|
||||||
return manifestMIMETypes
|
return []string{
|
||||||
|
imgspecv1.MediaTypeImageManifest,
|
||||||
|
manifest.DockerV2Schema2MediaType,
|
||||||
|
manifest.DockerV2Schema1SignedMediaType,
|
||||||
|
manifest.DockerV2Schema1MediaType,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
// SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures.
|
||||||
|
30
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
30
vendor/github.com/containers/image/docker/docker_image_src.go
generated
vendored
@ -21,41 +21,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type dockerImageSource struct {
|
type dockerImageSource struct {
|
||||||
ref dockerReference
|
ref dockerReference
|
||||||
requestedManifestMIMETypes []string
|
c *dockerClient
|
||||||
c *dockerClient
|
|
||||||
// State
|
// State
|
||||||
cachedManifest []byte // nil if not loaded yet
|
cachedManifest []byte // nil if not loaded yet
|
||||||
cachedManifestMIMEType string // Only valid if cachedManifest != nil
|
cachedManifestMIMEType string // Only valid if cachedManifest != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// newImageSource creates a new ImageSource for the specified image reference,
|
// newImageSource creates a new ImageSource for the specified image reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func newImageSource(ctx *types.SystemContext, ref dockerReference, requestedManifestMIMETypes []string) (*dockerImageSource, error) {
|
func newImageSource(ctx *types.SystemContext, ref dockerReference) (*dockerImageSource, error) {
|
||||||
c, err := newDockerClient(ctx, ref, false, "pull")
|
c, err := newDockerClient(ctx, ref, false, "pull")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if requestedManifestMIMETypes == nil {
|
|
||||||
requestedManifestMIMETypes = manifest.DefaultRequestedManifestMIMETypes
|
|
||||||
}
|
|
||||||
supportedMIMEs := supportedManifestMIMETypesMap()
|
|
||||||
acceptableRequestedMIMEs := false
|
|
||||||
for _, mtrequested := range requestedManifestMIMETypes {
|
|
||||||
if supportedMIMEs[mtrequested] {
|
|
||||||
acceptableRequestedMIMEs = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !acceptableRequestedMIMEs {
|
|
||||||
requestedManifestMIMETypes = manifest.DefaultRequestedManifestMIMETypes
|
|
||||||
}
|
|
||||||
return &dockerImageSource{
|
return &dockerImageSource{
|
||||||
ref: ref,
|
ref: ref,
|
||||||
requestedManifestMIMETypes: requestedManifestMIMETypes,
|
c: c,
|
||||||
c: c,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +78,7 @@ func (s *dockerImageSource) GetManifest() ([]byte, string, error) {
|
|||||||
func (s *dockerImageSource) fetchManifest(ctx context.Context, tagOrDigest string) ([]byte, string, error) {
|
func (s *dockerImageSource) fetchManifest(ctx context.Context, tagOrDigest string) ([]byte, string, error) {
|
||||||
path := fmt.Sprintf(manifestPath, reference.Path(s.ref.ref), tagOrDigest)
|
path := fmt.Sprintf(manifestPath, reference.Path(s.ref.ref), tagOrDigest)
|
||||||
headers := make(map[string][]string)
|
headers := make(map[string][]string)
|
||||||
headers["Accept"] = s.requestedManifestMIMETypes
|
headers["Accept"] = manifest.DefaultRequestedManifestMIMETypes
|
||||||
res, err := s.c.makeRequest(ctx, "GET", path, headers, nil)
|
res, err := s.c.makeRequest(ctx, "GET", path, headers, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", err
|
||||||
|
8
vendor/github.com/containers/image/docker/docker_transport.go
generated
vendored
8
vendor/github.com/containers/image/docker/docker_transport.go
generated
vendored
@ -130,12 +130,10 @@ func (ref dockerReference) NewImage(ctx *types.SystemContext) (types.Image, erro
|
|||||||
return newImage(ctx, ref)
|
return newImage(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref dockerReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref dockerReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref, requestedManifestMIMETypes)
|
return newImageSource(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
|
4
vendor/github.com/containers/image/oci/archive/oci_src.go
generated
vendored
4
vendor/github.com/containers/image/oci/archive/oci_src.go
generated
vendored
@ -19,13 +19,13 @@ type ociArchiveImageSource struct {
|
|||||||
|
|
||||||
// newImageSource returns an ImageSource for reading from an existing directory.
|
// newImageSource returns an ImageSource for reading from an existing directory.
|
||||||
// newImageSource untars the file and saves it in a temp directory
|
// newImageSource untars the file and saves it in a temp directory
|
||||||
func newImageSource(ctx *types.SystemContext, ref ociArchiveReference, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func newImageSource(ctx *types.SystemContext, ref ociArchiveReference) (types.ImageSource, error) {
|
||||||
tempDirRef, err := createUntarTempDir(ref)
|
tempDirRef, err := createUntarTempDir(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "error creating temp directory")
|
return nil, errors.Wrap(err, "error creating temp directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
unpackedSrc, err := tempDirRef.ociRefExtracted.NewImageSource(ctx, requestedManifestMIMETypes)
|
unpackedSrc, err := tempDirRef.ociRefExtracted.NewImageSource(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err := tempDirRef.deleteTempDir(); err != nil {
|
if err := tempDirRef.deleteTempDir(); err != nil {
|
||||||
return nil, errors.Wrapf(err, "error deleting temp directory", tempDirRef.tempDirectory)
|
return nil, errors.Wrapf(err, "error deleting temp directory", tempDirRef.tempDirectory)
|
||||||
|
9
vendor/github.com/containers/image/oci/archive/oci_transport.go
generated
vendored
9
vendor/github.com/containers/image/oci/archive/oci_transport.go
generated
vendored
@ -157,18 +157,17 @@ func (ref ociArchiveReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NewImage returns a types.Image for this reference, possibly specialized for this ImageTransport.
|
// NewImage returns a types.Image for this reference, possibly specialized for this ImageTransport.
|
||||||
// The caller must call .Close() on the returned Image.
|
// The caller must call .Close() on the returned Image.
|
||||||
func (ref ociArchiveReference) NewImage(ctx *types.SystemContext) (types.Image, error) {
|
func (ref ociArchiveReference) NewImage(ctx *types.SystemContext) (types.Image, error) {
|
||||||
src, err := newImageSource(ctx, ref, nil)
|
src, err := newImageSource(ctx, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return image.FromSource(src)
|
return image.FromSource(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref ociArchiveReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref ociArchiveReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref, requestedManifestMIMETypes)
|
return newImageSource(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
|
6
vendor/github.com/containers/image/oci/layout/oci_transport.go
generated
vendored
6
vendor/github.com/containers/image/oci/layout/oci_transport.go
generated
vendored
@ -241,11 +241,9 @@ func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor,
|
|||||||
return ociRef.getManifestDescriptor()
|
return ociRef.getManifestDescriptor()
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref ociReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref ociReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ref)
|
return newImageSource(ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
vendor/github.com/containers/image/openshift/openshift.go
generated
vendored
12
vendor/github.com/containers/image/openshift/openshift.go
generated
vendored
@ -162,18 +162,15 @@ func (c *openshiftClient) convertDockerImageReference(ref string) (string, error
|
|||||||
type openshiftImageSource struct {
|
type openshiftImageSource struct {
|
||||||
client *openshiftClient
|
client *openshiftClient
|
||||||
// Values specific to this image
|
// Values specific to this image
|
||||||
ctx *types.SystemContext
|
ctx *types.SystemContext
|
||||||
requestedManifestMIMETypes []string
|
|
||||||
// State
|
// State
|
||||||
docker types.ImageSource // The Docker Registry endpoint, or nil if not resolved yet
|
docker types.ImageSource // The Docker Registry endpoint, or nil if not resolved yet
|
||||||
imageStreamImageName string // Resolved image identifier, or "" if not known yet
|
imageStreamImageName string // Resolved image identifier, or "" if not known yet
|
||||||
}
|
}
|
||||||
|
|
||||||
// newImageSource creates a new ImageSource for the specified reference,
|
// newImageSource creates a new ImageSource for the specified reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func newImageSource(ctx *types.SystemContext, ref openshiftReference, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func newImageSource(ctx *types.SystemContext, ref openshiftReference) (types.ImageSource, error) {
|
||||||
client, err := newOpenshiftClient(ref)
|
client, err := newOpenshiftClient(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -182,7 +179,6 @@ func newImageSource(ctx *types.SystemContext, ref openshiftReference, requestedM
|
|||||||
return &openshiftImageSource{
|
return &openshiftImageSource{
|
||||||
client: client,
|
client: client,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
requestedManifestMIMETypes: requestedManifestMIMETypes,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +282,7 @@ func (s *openshiftImageSource) ensureImageIsResolved(ctx context.Context) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
d, err := dockerRef.NewImageSource(s.ctx, s.requestedManifestMIMETypes)
|
d, err := dockerRef.NewImageSource(s.ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
10
vendor/github.com/containers/image/openshift/openshift_transport.go
generated
vendored
10
vendor/github.com/containers/image/openshift/openshift_transport.go
generated
vendored
@ -130,19 +130,17 @@ func (ref openshiftReference) PolicyConfigurationNamespaces() []string {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
func (ref openshiftReference) NewImage(ctx *types.SystemContext) (types.Image, error) {
|
func (ref openshiftReference) NewImage(ctx *types.SystemContext) (types.Image, error) {
|
||||||
src, err := newImageSource(ctx, ref, nil)
|
src, err := newImageSource(ctx, ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return genericImage.FromSource(src)
|
return genericImage.FromSource(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref openshiftReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref openshiftReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(ctx, ref, requestedManifestMIMETypes)
|
return newImageSource(ctx, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
|
6
vendor/github.com/containers/image/ostree/ostree_transport.go
generated
vendored
6
vendor/github.com/containers/image/ostree/ostree_transport.go
generated
vendored
@ -185,11 +185,9 @@ func (ref ostreeReference) NewImage(ctx *types.SystemContext) (types.Image, erro
|
|||||||
return nil, errors.New("Reading ostree: images is currently not supported")
|
return nil, errors.New("Reading ostree: images is currently not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
func (ref ostreeReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (ref ostreeReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return nil, errors.New("Reading ostree: images is currently not supported")
|
return nil, errors.New("Reading ostree: images is currently not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
vendor/github.com/containers/image/storage/storage_reference.go
generated
vendored
2
vendor/github.com/containers/image/storage/storage_reference.go
generated
vendored
@ -154,7 +154,7 @@ func (s storageReference) DeleteImage(ctx *types.SystemContext) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s storageReference) NewImageSource(ctx *types.SystemContext, requestedManifestMIMETypes []string) (types.ImageSource, error) {
|
func (s storageReference) NewImageSource(ctx *types.SystemContext) (types.ImageSource, error) {
|
||||||
return newImageSource(s)
|
return newImageSource(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
vendor/github.com/containers/image/types/types.go
generated
vendored
6
vendor/github.com/containers/image/types/types.go
generated
vendored
@ -78,11 +78,9 @@ type ImageReference interface {
|
|||||||
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
// NOTE: If any kind of signature verification should happen, build an UnparsedImage from the value returned by NewImageSource,
|
||||||
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
// verify that UnparsedImage, and convert it into a real Image via image.FromUnparsedImage.
|
||||||
NewImage(ctx *SystemContext) (Image, error)
|
NewImage(ctx *SystemContext) (Image, error)
|
||||||
// NewImageSource returns a types.ImageSource for this reference,
|
// NewImageSource returns a types.ImageSource for this reference.
|
||||||
// asking the backend to use a manifest from requestedManifestMIMETypes if possible.
|
|
||||||
// nil requestedManifestMIMETypes means manifest.DefaultRequestedManifestMIMETypes.
|
|
||||||
// The caller must call .Close() on the returned ImageSource.
|
// The caller must call .Close() on the returned ImageSource.
|
||||||
NewImageSource(ctx *SystemContext, requestedManifestMIMETypes []string) (ImageSource, error)
|
NewImageSource(ctx *SystemContext) (ImageSource, error)
|
||||||
// NewImageDestination returns a types.ImageDestination for this reference.
|
// NewImageDestination returns a types.ImageDestination for this reference.
|
||||||
// The caller must call .Close() on the returned ImageDestination.
|
// The caller must call .Close() on the returned ImageDestination.
|
||||||
NewImageDestination(ctx *SystemContext) (ImageDestination, error)
|
NewImageDestination(ctx *SystemContext) (ImageDestination, error)
|
||||||
|
Loading…
Reference in New Issue
Block a user