MCPcopy Create free account
hub / github.com/docker/cli / buildManifestDescriptor

Function buildManifestDescriptor

cli/command/manifest/push.go:143–168  ·  view source on GitHub ↗
(targetRepo reference.Named, imageManifest types.ImageManifest)

Source from the content-addressed store, hash-verified

141}
142
143func buildManifestDescriptor(targetRepo reference.Named, imageManifest types.ImageManifest) (manifestlist.ManifestDescriptor, error) {
144 manifestRepoHostname := reference.Domain(reference.TrimNamed(imageManifest.Ref))
145 targetRepoHostname := reference.Domain(reference.TrimNamed(targetRepo))
146 if manifestRepoHostname != targetRepoHostname {
147 return manifestlist.ManifestDescriptor{}, fmt.Errorf("cannot use source images from a different registry than the target image: %s != %s", manifestRepoHostname, targetRepoHostname)
148 }
149
150 manifest := manifestlist.ManifestDescriptor{
151 Descriptor: distribution.Descriptor{
152 Digest: imageManifest.Descriptor.Digest,
153 Size: imageManifest.Descriptor.Size,
154 MediaType: imageManifest.Descriptor.MediaType,
155 },
156 }
157
158 platform := types.PlatformSpecFromOCI(imageManifest.Descriptor.Platform)
159 if platform != nil {
160 manifest.Platform = *platform
161 }
162
163 if err := manifest.Descriptor.Digest.Validate(); err != nil {
164 return manifestlist.ManifestDescriptor{}, fmt.Errorf("digest parse of image %q failed: %w", imageManifest.Ref, err)
165 }
166
167 return manifest, nil
168}
169
170func buildBlobRequestList(imageManifest types.ImageManifest, repoName reference.Named) ([]manifestBlob, error) {
171 blobs := imageManifest.Blobs()

Callers 2

buildManifestListFunction · 0.85
printManifestListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…