From 6ca0aebf0c40c3a2ea59c0ede440f9b6be5d1ded Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Mon, 25 Sep 2023 22:10:19 +0000 Subject: [PATCH] Allow for images with artifacts to pull Signed-off-by: James Sturtevant (cherry picked from commit a9ba33f8ff8b7ec8d4af736c68f5a73753f970ea) Signed-off-by: James Sturtevant --- image.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/image.go b/image.go index 40dc3ff6cb..46854fc4fa 100644 --- a/image.go +++ b/image.go @@ -437,7 +437,15 @@ func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer, if err != nil { return nil, fmt.Errorf("failed to resolve rootfs: %w", err) } - if len(diffIDs) != len(manifest.Layers) { + + // parse out the image layers from oci artifact layers + imageLayers := []ocispec.Descriptor{} + for _, ociLayer := range manifest.Layers { + if images.IsLayerType(ociLayer.MediaType) { + imageLayers = append(imageLayers, ociLayer) + } + } + if len(diffIDs) != len(imageLayers) { return nil, errors.New("mismatched image rootfs and manifest layers") } layers := make([]rootfs.Layer, len(diffIDs)) @@ -447,7 +455,7 @@ func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer, MediaType: ocispec.MediaTypeImageLayer, Digest: diffIDs[i], } - layers[i].Blob = manifest.Layers[i] + layers[i].Blob = imageLayers[i] } return layers, nil }