(targetRepo reference.Named, imageManifest types.ImageManifest)
| 141 | } |
| 142 | |
| 143 | func 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 | |
| 170 | func buildBlobRequestList(imageManifest types.ImageManifest, repoName reference.Named) ([]manifestBlob, error) { |
| 171 | blobs := imageManifest.Blobs() |
no outgoing calls
no test coverage detected
searching dependent graphs…