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

Method updateEmbeddedDockerReference

copy/single.go:355–373  ·  view source on GitHub ↗

updateEmbeddedDockerReference handles the Docker reference embedded in Docker schema1 manifests.

()

Source from the content-addressed store, hash-verified

353
354// updateEmbeddedDockerReference handles the Docker reference embedded in Docker schema1 manifests.
355func (ic *imageCopier) updateEmbeddedDockerReference() error {
356 if ic.c.dest.IgnoresEmbeddedDockerReference() {
357 return nil // Destination would prefer us not to update the embedded reference.
358 }
359 destRef := ic.c.dest.Reference().DockerReference()
360 if destRef == nil {
361 return nil // Destination does not care about Docker references
362 }
363 if !ic.src.EmbeddedDockerReferenceConflicts(destRef) {
364 return nil // No reference embedded in the manifest, or it matches destRef already.
365 }
366
367 if ic.cannotModifyManifestReason != "" {
368 return fmt.Errorf("Copying a schema1 image with an embedded Docker reference to %s (Docker reference %s) would change the manifest, which we cannot do: %q",
369 transports.ImageName(ic.c.dest.Reference()), destRef.String(), ic.cannotModifyManifestReason)
370 }
371 ic.manifestUpdates.EmbeddedDockerReference = destRef
372 return nil
373}
374
375func (ic *imageCopier) noPendingManifestUpdates() bool {
376 return reflect.DeepEqual(*ic.manifestUpdates, types.ManifestUpdateOptions{InformationOnly: ic.manifestUpdates.InformationOnly})

Callers 1

copySingleImageMethod · 0.95

Calls 6

ImageNameFunction · 0.92
DockerReferenceMethod · 0.65
ReferenceMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected