fetchManifest pulls a manifest from a registry and returns it. An error is returned if no manifest is found matching namedRef.
(ctx context.Context, repo distribution.Repository, ref reference.Named)
| 24 | // fetchManifest pulls a manifest from a registry and returns it. An error |
| 25 | // is returned if no manifest is found matching namedRef. |
| 26 | func fetchManifest(ctx context.Context, repo distribution.Repository, ref reference.Named) (types.ImageManifest, error) { |
| 27 | manifest, err := getManifest(ctx, repo, ref) |
| 28 | if err != nil { |
| 29 | return types.ImageManifest{}, err |
| 30 | } |
| 31 | |
| 32 | switch v := manifest.(type) { |
| 33 | // Removed Schema 1 support |
| 34 | case *schema2.DeserializedManifest: |
| 35 | return pullManifestSchemaV2(ctx, ref, repo, *v) |
| 36 | case *ocischema.DeserializedManifest: |
| 37 | return pullManifestOCISchema(ctx, ref, repo, *v) |
| 38 | case *manifestlist.DeserializedManifestList: |
| 39 | return types.ImageManifest{}, fmt.Errorf("%s is a manifest list", ref) |
| 40 | } |
| 41 | return types.ImageManifest{}, fmt.Errorf("%s is not a manifest", ref) |
| 42 | } |
| 43 | |
| 44 | func fetchList(ctx context.Context, repo distribution.Repository, ref reference.Named) ([]types.ImageManifest, error) { |
| 45 | manifest, err := getManifest(ctx, repo, ref) |
no test coverage detected
searching dependent graphs…