Skip to content

Commit a9ba33f

Browse files
committed
Allow for images with artifacts to pull
Signed-off-by: James Sturtevant <[email protected]>
1 parent e0e6f87 commit a9ba33f

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
@@ -379,7 +379,15 @@ func (i *image) getLayers(ctx context.Context, manifest ocispec.Manifest) ([]roo
379379
if err != nil {
380380
return nil, fmt.Errorf("failed to resolve rootfs: %w", err)
381381
}
382-
if len(diffIDs) != len(manifest.Layers) {
382+
383+
// parse out the image layers from oci artifact layers
384+
imageLayers := []ocispec.Descriptor{}
385+
for _, ociLayer := range manifest.Layers {
386+
if images.IsLayerType(ociLayer.MediaType) {
387+
imageLayers = append(imageLayers, ociLayer)
388+
}
389+
}
390+
if len(diffIDs) != len(imageLayers) {
383391
return nil, errors.New("mismatched image rootfs and manifest layers")
384392
}
385393
layers := make([]rootfs.Layer, len(diffIDs))
@@ -389,7 +397,7 @@ func (i *image) getLayers(ctx context.Context, manifest ocispec.Manifest) ([]roo
389397
MediaType: ocispec.MediaTypeImageLayer,
390398
Digest: diffIDs[i],
391399
}
392-
layers[i].Blob = manifest.Layers[i]
400+
layers[i].Blob = imageLayers[i]
393401
}
394402
return layers, nil
395403
}

0 commit comments

Comments
 (0)