fix: handle single arch images#489
Merged
Merged
Conversation
frezbo
reviewed
Jun 29, 2026
7cb7f28 to
307eaac
Compare
Orzelius
commented
Jun 29, 2026
Comment on lines
+72
to
+81
| // go-containerregistry's partial.Descriptor only copies Platform onto the index entry | ||
| // when the image was resolved from a multi-arch index. Derive platform from the image's | ||
| // config file if present so single arch images keep working. | ||
| if cfg, cfgErr := img.ConfigFile(); cfgErr == nil && cfg.Architecture != "" { | ||
| opts = append(opts, layout.WithPlatform(v1.Platform{ | ||
| OS: cfg.OS, | ||
| Architecture: cfg.Architecture, | ||
| Variant: cfg.Variant, | ||
| })) | ||
| } |
Member
Author
There was a problem hiding this comment.
This here is the only change
There was a problem hiding this comment.
Pull request overview
This PR fixes OCI export of single-arch images by ensuring the OCI index entry records a platform descriptor even when the image wasn’t resolved from a multi-arch index (working around go-containerregistry’s partial.Descriptor behavior). It also centralizes image export handling into a shared imagehandler package.
Changes:
- Introduce
internal/artifacts/imagehandlerwithExport(tar streaming) andOCI(OCI layout export) handlers. - Update artifact fetching code paths to use the shared
imagehandlerhelpers. - Add a unit test to assert
OCIrecords platform for single-arch images using config-derived OS/arch.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/artifacts/versions.go | Switch to imagehandler.Export for extension/overlay/talosctl list extraction. |
| internal/artifacts/fetch.go | Replace in-file handler implementations with imagehandler.Export/imagehandler.OCI. |
| internal/artifacts/spdx.go | Adjust handler type to imagehandler.Handler (but retains duplicated export logic). |
| internal/artifacts/imagehandler/imagehandler.go | New shared image handlers; OCI now derives platform from image config when present. |
| internal/artifacts/imagehandler/imagehandler_test.go | New test validating platform descriptor is recorded in OCI layout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
smira
reviewed
Jun 29, 2026
smira
reviewed
Jun 29, 2026
smira
approved these changes
Jun 29, 2026
go-containerregistry's partial.Descriptor only copies Platform onto the index entry when the image was resolved from a multi-arch index. Derive platform from the image's config file if present so single arch images keep working. Part of siderolabs#395 Signed-off-by: Orzelius <33936483+Orzelius@users.noreply.github.com>
307eaac to
3bccbe1
Compare
Orzelius
commented
Jun 29, 2026
| } | ||
|
|
||
| // SPDX creates an image handler that extracts SPDX files. | ||
| func SPDX(files *[]SPDXFile, source string) Handler { |
Member
Author
There was a problem hiding this comment.
also extracted the SPDX handler
Member
Author
|
/m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
go-containerregistry's partial.Descriptor only copies Platform onto the index entry when the image was resolved from a multi-arch index. Derive platform from the image's config file if present so single arch images keep working.
Part of #395