Skip to content

feat: add multi-platform OCI image support#548

Open
jasonpaulos wants to merge 2 commits intoanchore:mainfrom
jasonpaulos:multiplatform-oci
Open

feat: add multi-platform OCI image support#548
jasonpaulos wants to merge 2 commits intoanchore:mainfrom
jasonpaulos:multiplatform-oci

Conversation

@jasonpaulos
Copy link

@jasonpaulos jasonpaulos commented Mar 19, 2026

Add support to OCI directory image provider for multi-platform OCI images.

Similar to registry images, the user-provided platform is used to select the correct image, unless there is only 1 image available, in which case it will be selected regardless of platform.

Unit and integration tests added to verify functionality.

This fixes #175 and anchore/syft#1545 and addresses part of anchore/syft#1683. To clarify, this doesn't add support for scanning multiple platforms simultaneously, but it does allow stereoscope & syft to operate on a single image within a multi-platform OCI image, which is currently not possible.

Signed-off-by: Jason Paulos <jasonpaulos@users.noreply.github.com>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file just contains helper functions moved from registry_provider.go


// NewDirectoryProviderWithPlatform creates a new provider instance for the specific image already at the given path,
// with the given platform information to use when loading a multiplatform image.
func NewDirectoryProviderWithPlatform(tmpDirGen *file.TempDirGenerator, path string, platform *image.Platform) image.Provider {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a new constructor to avoid a potential breaking change on the existing one. Let me know if that's not a concern


indexManifest, err := index.IndexManifest()
if err != nil {
if _, err := index.IndexManifest(); err != nil {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this check and layout.FromPath here even though their results aren't used to keep the error messages the same in these failures

Signed-off-by: Jason Paulos <jasonpaulos@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for image indexes with multiple manifests

1 participant