pullManifestList handles "manifest lists" which point to various platform-specific manifests.
(ctx context.Context, ref reference.Named, repo distribution.Repository, mfstList manifestlist.DeserializedManifestList)
| 153 | // pullManifestList handles "manifest lists" which point to various |
| 154 | // platform-specific manifests. |
| 155 | func pullManifestList(ctx context.Context, ref reference.Named, repo distribution.Repository, mfstList manifestlist.DeserializedManifestList) ([]types.ImageManifest, error) { |
| 156 | if _, err := validateManifestDigest(ref, mfstList); err != nil { |
| 157 | return nil, err |
| 158 | } |
| 159 | |
| 160 | infos := make([]types.ImageManifest, 0, len(mfstList.Manifests)) |
| 161 | for _, manifestDescriptor := range mfstList.Manifests { |
| 162 | manSvc, err := repo.Manifests(ctx) |
| 163 | if err != nil { |
| 164 | return nil, err |
| 165 | } |
| 166 | manifest, err := manSvc.Get(ctx, manifestDescriptor.Digest) |
| 167 | if err != nil { |
| 168 | return nil, err |
| 169 | } |
| 170 | |
| 171 | manifestRef, err := reference.WithDigest(ref, manifestDescriptor.Digest) |
| 172 | if err != nil { |
| 173 | return nil, err |
| 174 | } |
| 175 | |
| 176 | var imageManifest types.ImageManifest |
| 177 | switch v := manifest.(type) { |
| 178 | case *schema2.DeserializedManifest: |
| 179 | imageManifest, err = pullManifestSchemaV2(ctx, manifestRef, repo, *v) |
| 180 | case *ocischema.DeserializedManifest: |
| 181 | imageManifest, err = pullManifestOCISchema(ctx, manifestRef, repo, *v) |
| 182 | default: |
| 183 | err = fmt.Errorf("unsupported manifest type: %T", manifest) |
| 184 | } |
| 185 | if err != nil { |
| 186 | return nil, err |
| 187 | } |
| 188 | |
| 189 | // Replace platform from config |
| 190 | p := manifestDescriptor.Platform |
| 191 | imageManifest.Descriptor.Platform = types.OCIPlatform(&p) |
| 192 | |
| 193 | infos = append(infos, imageManifest) |
| 194 | } |
| 195 | return infos, nil |
| 196 | } |
| 197 | |
| 198 | func continueOnError(err error) bool { |
| 199 | switch v := err.(type) { |
no test coverage detected
searching dependent graphs…