MCPcopy Create free account
hub / github.com/containers/image / newImageDestination

Function newImageDestination

openshift/openshift_dest.go:39–64  ·  view source on GitHub ↗

newImageDestination creates a new ImageDestination for the specified reference.

(ctx context.Context, sys *types.SystemContext, ref openshiftReference)

Source from the content-addressed store, hash-verified

37
38// newImageDestination creates a new ImageDestination for the specified reference.
39func newImageDestination(ctx context.Context, sys *types.SystemContext, ref openshiftReference) (private.ImageDestination, error) {
40 client, err := newOpenshiftClient(ref)
41 if err != nil {
42 return nil, err
43 }
44
45 // FIXME: Should this always use a digest, not a tag? Uploading to Docker by tag requires the tag _inside_ the manifest to match,
46 // i.e. a single signed image cannot be available under multiple tags. But with types.ImageDestination, we don't know
47 // the manifest digest at this point.
48 dockerRefString := fmt.Sprintf("//%s/%s/%s:%s", reference.Domain(client.ref.dockerReference), client.ref.namespace, client.ref.stream, client.ref.dockerReference.Tag())
49 dockerRef, err := docker.ParseReference(dockerRefString)
50 if err != nil {
51 return nil, err
52 }
53 docker, err := dockerRef.NewImageDestination(ctx, sys)
54 if err != nil {
55 return nil, err
56 }
57
58 d := &openshiftImageDestination{
59 client: client,
60 docker: imagedestination.FromPublic(docker),
61 }
62 d.Compat = impl.AddCompat(d)
63 return d, nil
64}
65
66// Reference returns the reference used to set up this destination. Note that this should directly correspond to user's intent,
67// e.g. it should use the public hostname instead of the result of resolving CNAMEs or following redirects.

Callers 1

NewImageDestinationMethod · 0.70

Calls 7

DomainFunction · 0.92
FromPublicFunction · 0.92
AddCompatFunction · 0.92
newOpenshiftClientFunction · 0.85
TagMethod · 0.65
ParseReferenceMethod · 0.65
NewImageDestinationMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…