Skip to content

Commit

Permalink
Allow for images with artifacts to pull
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
(cherry picked from commit a9ba33f)
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant committed Oct 6, 2023
1 parent 72e0200 commit 6ca0aeb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
}
Expand Down

0 comments on commit 6ca0aeb

Please sign in to comment.