Skip to content

fix: handle single arch images#489

Merged
talos-bot merged 1 commit into
siderolabs:mainfrom
Orzelius:single-arch-images
Jun 29, 2026
Merged

fix: handle single arch images#489
talos-bot merged 1 commit into
siderolabs:mainfrom
Orzelius:single-arch-images

Conversation

@Orzelius

Copy link
Copy Markdown
Member

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

@github-project-automation github-project-automation Bot moved this to To Do in Planning Jun 29, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Jun 29, 2026
Comment thread .DS_Store Outdated
@Orzelius Orzelius force-pushed the single-arch-images branch from 7cb7f28 to 307eaac Compare June 29, 2026 13:33
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,
}))
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This here is the only change

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/imagehandler with Export (tar streaming) and OCI (OCI layout export) handlers.
  • Update artifact fetching code paths to use the shared imagehandler helpers.
  • Add a unit test to assert OCI records 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.

Comment thread internal/artifacts/imagehandler/imagehandler.go
Comment thread internal/artifacts/spdx.go Outdated
Comment thread internal/artifacts/imagehandler/imagehandler_test.go Outdated
Comment thread internal/artifacts/imagehandler/imagehandler_test.go
@github-project-automation github-project-automation Bot moved this from In Review to Approved in Planning 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>
@Orzelius Orzelius force-pushed the single-arch-images branch from 307eaac to 3bccbe1 Compare June 29, 2026 14:28
}

// SPDX creates an image handler that extracts SPDX files.
func SPDX(files *[]SPDXFile, source string) Handler {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

also extracted the SPDX handler

@Orzelius

Copy link
Copy Markdown
Member Author

/m

@talos-bot talos-bot merged commit 3bccbe1 into siderolabs:main Jun 29, 2026
21 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in Planning Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants