Skip to content

ocidir: Handle case when index entry has no platform annotation#73

Merged
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:fix-no-platform-annotation
Apr 27, 2026
Merged

ocidir: Handle case when index entry has no platform annotation#73
cgwalters merged 1 commit intobootc-dev:mainfrom
cgwalters:fix-no-platform-annotation

Conversation

@cgwalters
Copy link
Copy Markdown
Collaborator

The OCI image-index spec marks the platform field on index entries as
OPTIONAL. A single-manifest OCI layout produced by tools like skopeo copy containers-storage:... oci:/path:tag typically omits this field entirely,
which previously caused open_image_this_platform to fail with a
"no manifest found for platform" error even though the image is perfectly
valid.

Match what other container runtimes do - directly inspect the manifest
and find the platform from the config.

The same fallback is applied inside resolve_manifest_list for entries inside
a nested image index.

Assisted-by: OpenCode (claude-sonnet-4-6@default)

The OCI image-index spec marks the `platform` field on index entries as
OPTIONAL. A single-manifest OCI layout produced by tools like `skopeo copy
containers-storage:... oci:/path:tag` typically omits this field entirely,
which previously caused `open_image_this_platform` to fail with a
"no manifest found for platform" error even though the image is perfectly
valid.

Match what other container runtimes do - directly inspect the manifest
and find the platform from the config.

The same fallback is applied inside `resolve_manifest_list` for entries inside
a nested image index.

Assisted-by: OpenCode (claude-sonnet-4-6@default)
Signed-off-by: Colin Walters <walters@verbum.org>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fallback mechanism for OCI platform resolution when descriptors lack explicit platform annotations by reading the manifest's configuration blob. The feedback highlights that the current media type check is too restrictive and should include Docker-formatted images to ensure compatibility with tools like skopeo. Additionally, there is a concern regarding robustness; the current implementation bubbles up I/O and parse errors during the probing phase, which could cause the entire resolution to fail if a single non-native blob is corrupt or missing.

Comment thread src/lib.rs
Comment thread src/lib.rs
Copy link
Copy Markdown
Contributor

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

/lgtm

@cgwalters cgwalters merged commit 4f0d0b2 into bootc-dev:main Apr 27, 2026
4 checks passed
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.

2 participants