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

Function pullManifestList

internal/registryclient/fetcher.go:155–196  ·  view source on GitHub ↗

pullManifestList handles "manifest lists" which point to various platform-specific manifests.

(ctx context.Context, ref reference.Named, repo distribution.Repository, mfstList manifestlist.DeserializedManifestList)

Source from the content-addressed store, hash-verified

153// pullManifestList handles "manifest lists" which point to various
154// platform-specific manifests.
155func 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
198func continueOnError(err error) bool {
199 switch v := err.(type) {

Callers 1

fetchListFunction · 0.85

Calls 4

validateManifestDigestFunction · 0.85
pullManifestSchemaV2Function · 0.85
pullManifestOCISchemaFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…