You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Specification Deviation in Multi Arch Artifacts #2015
@apparentlymart do you have any context regarding this issue from opentofu' point of view? @TerryHowe mentioned someone from opentofu raised this issue to us at KubeCon EU.
"Implementers note: artifacts have historically been created without an artifactType field, and tooling to work with artifacts should fallback to the config.mediaType value."
ORAS's enrichDescriptor in cmd/oras/root/manifest/index/create.go:239 sets:
desc.ArtifactType=manifest.ArtifactType
For old-style artifacts (those using a custom config.mediaType rather than the manifest.artifactType field — which is the case for historically created artifacts like OpenTofu providers), this leaves desc.ArtifactType empty in the index descriptor. The correct behavior is to fall back to manifest.Config.MediaType when manifest.ArtifactType is empty and config.mediaType is not the standard OCI image config type.
The fix in enrichDescriptor:
desc.ArtifactType=manifest.ArtifactType// Fall back to config.mediaType for old-style artifactsifdesc.ArtifactType==""&&manifest.Config.MediaType!=ocispec.MediaTypeImageConfig {
desc.ArtifactType=manifest.Config.MediaType
}
The same fix is needed in cmd/oras/root/manifest/index/update.go.
Issue 2 — No mechanism to attach platform to artifact descriptors in an index
getPlatform (create.go:185) reads platform info from the config blob by unmarshalling it and looking for architecture/os fields. This works for OCI image configs but not for arbitrary artifact configs. For platform-specific artifacts (e.g., a per-arch provider binary), the config blob typically won't have those fields, so platform will always be nil in the index descriptor.
Currently there is no flag on oras manifest index create to explicitly specify os/arch per source manifest, so there's no way for users to produce a spec-compliant multi-platform artifact index.
A --platform flag (or similar) would be needed to allow callers to specify os/arch for artifact manifests that don't embed platform in their config.
Test gap
All existing unit tests in create_test.go use manifests with artifactType already set explicitly. There is no test for the old-style fallback path (artifactType empty, custom config.mediaType).
@apparentlymart — does either of these match what you observed? Knowing whether it's the artifactType fallback, the missing platform mechanism, or something else would help narrow down the fix.
I'm afraid that it's been a while since I was thinking about this stuff and so I don't have the context ready in my brain, but what follows are some quick reactions based on what I was able to find with some quick research:
OpenTofu doesn't make use of the config property of a manifest at all, because it doesn't need any additional metadata beyond what's already tracked elsewhere in the manifests.
IIRC in our earlier instructions about manually constructing manifests (before we updated our docs to use the ORAS CLI commands) we suggested folks should set the config descriptor to refer to the zero-length blob digest and use mediaType application/vnd.oci.empty.v1+json, but as far as I can tell OpenTofu doesn't actually check that and really just ignores the config descriptor entirely.
OpenTofu's logic for deciding whether an artifact is intended to be an OpenTofu provider package is based purely on the artifactType property, where we require application/vnd.opentofu.provider for the index manifest and application/vnd.opentofu.provider-target for each image manifest it refers to. The new features we previously contributed to ORAS CLI were primarily motivated by allowing folks to set those custom artifactType values.
We documented what OpenTofu expects for a provider package artifact in Manifest Structure.
While I was working on that I noticed (and briefly participated in) Identifying Platform-Specific OCI Artifacts opencontainers/image-spec#1216 where ORAS team members were discussing how ORAS could "remember" the target platform for an image manifest when someone uses oras push with the --artifact-platform option, because the only standardized place to store that information is in the descriptors in the index manifest, which doesn't exist yet at that point in the workflow.
I think I remember finding at the time I was working on this stuff that oras push was using the config blob as a temporary place to stash the platform information, but perhaps I'm misremembering. If that's still true then I assume that means ORAS CLI itself must be generating or modifying the config blob, and so both the data in it and the mediaType used to refer to it would be decided by ORAS CLI.
With all of this said: I'm not 100% sure I understand exactly what problem this issue is aiming to solve, and so perhaps what I've shared above is not actually helpful. If it seems like I'm sharing things that aren't relevant to what you are asking please let me know and I'm happy to answer some more specific questions, either from my memory or by reading the relevant parts of the OpenTofu code.
In case it's useful context, our documentation on how to use ORAS CLI to build provider package artifacts for OpenTofu is in Assembling and Pushing Provider Manifests. In particular notice that the example oras push command only sets --artifact-platform and doesn't attempt to directly specify the content or mediaType for the "config" blob.
Activity
FeynmanZhou commentedon Apr 1, 2026
@apparentlymart do you have any context regarding this issue from opentofu' point of view? @TerryHowe mentioned someone from opentofu raised this issue to us at KubeCon EU.
TerryHowe commentedon Apr 1, 2026
@bupd you were familiar with this issue and the person that brought this up to me. Who was that again? Thanks in advance.
TerryHowe commentedon Apr 1, 2026
Issue Assessment
After reviewing the relevant spec and code, I've identified two likely deviations.
Issue 1 — Missing
config.mediaTypefallback for descriptorartifactTypedescriptor.mdspecifies:And
manifest.mdnotes:ORAS's
enrichDescriptorincmd/oras/root/manifest/index/create.go:239sets:For old-style artifacts (those using a custom
config.mediaTyperather than themanifest.artifactTypefield — which is the case for historically created artifacts like OpenTofu providers), this leavesdesc.ArtifactTypeempty in the index descriptor. The correct behavior is to fall back tomanifest.Config.MediaTypewhenmanifest.ArtifactTypeis empty andconfig.mediaTypeis not the standard OCI image config type.The fix in
enrichDescriptor:The same fix is needed in
cmd/oras/root/manifest/index/update.go.Issue 2 — No mechanism to attach platform to artifact descriptors in an index
getPlatform(create.go:185) reads platform info from the config blob by unmarshalling it and looking forarchitecture/osfields. This works for OCI image configs but not for arbitrary artifact configs. For platform-specific artifacts (e.g., a per-arch provider binary), the config blob typically won't have those fields, soplatformwill always benilin the index descriptor.Currently there is no flag on
oras manifest index createto explicitly specifyos/archper source manifest, so there's no way for users to produce a spec-compliant multi-platform artifact index.A
--platformflag (or similar) would be needed to allow callers to specifyos/archfor artifact manifests that don't embed platform in their config.Test gap
All existing unit tests in
create_test.gouse manifests withartifactTypealready set explicitly. There is no test for the old-style fallback path (artifactTypeempty, customconfig.mediaType).@apparentlymart — does either of these match what you observed? Knowing whether it's the
artifactTypefallback, the missing platform mechanism, or something else would help narrow down the fix.apparentlymart commentedon Apr 1, 2026
I'm afraid that it's been a while since I was thinking about this stuff and so I don't have the context ready in my brain, but what follows are some quick reactions based on what I was able to find with some quick research:
OpenTofu doesn't make use of the
configproperty of a manifest at all, because it doesn't need any additional metadata beyond what's already tracked elsewhere in the manifests.IIRC in our earlier instructions about manually constructing manifests (before we updated our docs to use the ORAS CLI commands) we suggested folks should set the config descriptor to refer to the zero-length blob digest and use mediaType
application/vnd.oci.empty.v1+json, but as far as I can tell OpenTofu doesn't actually check that and really just ignores the config descriptor entirely.OpenTofu's logic for deciding whether an artifact is intended to be an OpenTofu provider package is based purely on the
artifactTypeproperty, where we requireapplication/vnd.opentofu.providerfor the index manifest andapplication/vnd.opentofu.provider-targetfor each image manifest it refers to. The new features we previously contributed to ORAS CLI were primarily motivated by allowing folks to set those customartifactTypevalues.We documented what OpenTofu expects for a provider package artifact in Manifest Structure.
While I was working on that I noticed (and briefly participated in) Identifying Platform-Specific OCI Artifacts opencontainers/image-spec#1216 where ORAS team members were discussing how ORAS could "remember" the target platform for an image manifest when someone uses
oras pushwith the--artifact-platformoption, because the only standardized place to store that information is in the descriptors in the index manifest, which doesn't exist yet at that point in the workflow.I think I remember finding at the time I was working on this stuff that
oras pushwas using the config blob as a temporary place to stash the platform information, but perhaps I'm misremembering. If that's still true then I assume that means ORAS CLI itself must be generating or modifying the config blob, and so both the data in it and the mediaType used to refer to it would be decided by ORAS CLI.With all of this said: I'm not 100% sure I understand exactly what problem this issue is aiming to solve, and so perhaps what I've shared above is not actually helpful. If it seems like I'm sharing things that aren't relevant to what you are asking please let me know and I'm happy to answer some more specific questions, either from my memory or by reading the relevant parts of the OpenTofu code.
In case it's useful context, our documentation on how to use ORAS CLI to build provider package artifacts for OpenTofu is in Assembling and Pushing Provider Manifests. In particular notice that the example
oras pushcommand only sets--artifact-platformand doesn't attempt to directly specify the content or mediaType for the "config" blob.github-actions commentedon Jun 1, 2026
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
github-actions commentedon Aug 1, 2026
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.