(ctx context.Context, manifest ocispec.Manifest)
| 394 | } |
| 395 | |
| 396 | func (i *image) getLayers(ctx context.Context, manifest ocispec.Manifest) ([]rootfs.Layer, error) { |
| 397 | diffIDs, err := i.RootFS(ctx) |
| 398 | if err != nil { |
| 399 | return nil, fmt.Errorf("failed to resolve rootfs: %w", err) |
| 400 | } |
| 401 | |
| 402 | // parse out the image layers from oci artifact layers |
| 403 | imageLayers := []ocispec.Descriptor{} |
| 404 | for _, ociLayer := range manifest.Layers { |
| 405 | if images.IsLayerType(ociLayer.MediaType) { |
| 406 | imageLayers = append(imageLayers, ociLayer) |
| 407 | } |
| 408 | } |
| 409 | if len(diffIDs) != len(imageLayers) { |
| 410 | return nil, errors.New("mismatched image rootfs and manifest layers") |
| 411 | } |
| 412 | layers := make([]rootfs.Layer, len(diffIDs)) |
| 413 | for i := range diffIDs { |
| 414 | layers[i].Diff = ocispec.Descriptor{ |
| 415 | // TODO: derive media type from compressed type |
| 416 | MediaType: ocispec.MediaTypeImageLayer, |
| 417 | Digest: diffIDs[i], |
| 418 | } |
| 419 | layers[i].Blob = imageLayers[i] |
| 420 | } |
| 421 | return layers, nil |
| 422 | } |
| 423 | |
| 424 | func (i *image) checkSnapshotterSupport(ctx context.Context, snapshotterName string, |
| 425 | manifest ocispec.Manifest, checkSnapshotterSupport bool) error { |
no test coverage detected