Skip to content

Commit c33249c

Browse files
authored
Merge pull request containerd#9142 from jsturtevant/no-changes-wasm
Allow for images with artifacts layers to pull and run
2 parents 0f3d312 + a9ba33f commit c33249c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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)