Skip to content

Commit 8066dd8

Browse files
committed
Allow for images with artifacts to pull
Signed-off-by: James Sturtevant <[email protected]> (cherry picked from commit a9ba33f) Signed-off-by: James Sturtevant <[email protected]>
1 parent b0d49cd commit 8066dd8

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

image.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,15 @@ func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer,
414414
if err != nil {
415415
return nil, fmt.Errorf("failed to resolve rootfs: %w", err)
416416
}
417-
if len(diffIDs) != len(manifest.Layers) {
417+
418+
// parse out the image layers from oci artifact layers
419+
imageLayers := []ocispec.Descriptor{}
420+
for _, ociLayer := range manifest.Layers {
421+
if images.IsLayerType(ociLayer.MediaType) {
422+
imageLayers = append(imageLayers, ociLayer)
423+
}
424+
}
425+
if len(diffIDs) != len(imageLayers) {
418426
return nil, errors.New("mismatched image rootfs and manifest layers")
419427
}
420428
layers := make([]rootfs.Layer, len(diffIDs))
@@ -424,7 +432,7 @@ func (i *image) getLayers(ctx context.Context, platform platforms.MatchComparer,
424432
MediaType: ocispec.MediaTypeImageLayer,
425433
Digest: diffIDs[i],
426434
}
427-
layers[i].Blob = manifest.Layers[i]
435+
layers[i].Blob = imageLayers[i]
428436
}
429437
return layers, nil
430438
}

0 commit comments

Comments
 (0)