newImageDestination creates a new ImageDestination for the specified reference.
(ctx context.Context, sys *types.SystemContext, ref openshiftReference)
| 37 | |
| 38 | // newImageDestination creates a new ImageDestination for the specified reference. |
| 39 | func 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. |
no test coverage detected
searching dependent graphs…