fix: skeleton packages included only one architecture per component - #5146
Open
yohanb wants to merge 8 commits into
Open
fix: skeleton packages included only one architecture per component#5146yohanb wants to merge 8 commits into
yohanb wants to merge 8 commits into
Conversation
Signed-off-by: Yohan Belval <ybelval@genetec.com>
✅ Deploy Preview for zarf-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Signed-off-by: Yohan Belval <ybelval@genetec.com>
Signed-off-by: Yohan Belval <yohan.belval@gmail.com>
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.
Description
When publishing a skeleton package,
PackageDefinitionresolved imports using the host machine's architecture as thefilter. This meant that multi-arch source packages (where the same component name appears once per architecture, e.g.
two zarf-injector entries; amd64 & arm64) had all but the host arch variant silently dropped during import
resolution.
Consequently, a skeleton published from an amd64 machine would only contain the amd64 variant of zarf-injector. An
arm64 user importing from that skeleton would fail to find a compatible component.
Changes
Variant dimension abstraction (
load.go)Introduced
VariantDimension(VariantArchitecture,VariantFlavor) andSkipVariantFilters []VariantDimensionon
DefinitionOptions. Callers pass the dimensions they want to retain;load.PackageDefinitionpasses themstraight through to
resolveImportswithout any skeleton-specific logic or sentinel values.publish.gopassesSkipVariantFilters: []load.VariantDimension{load.VariantArchitecture}when publishing askeleton, keeping the load package free of skeleton-specific knowledge.
Multi-arch import resolution (
import.go)resolveImportsandcompatibleComponentacceptskipVariantFilters []VariantDimensioninstead of relying onthe
SkeletonArchsentinel. WhenVariantArchitectureis skipped, every arch variant of a matching componentis collected instead of filtered to one.
VariantArchitectureis not skipped, the existing"multiple components named X found" error is returned (non-skeleton behaviour unchanged).
Arch-qualified tarball naming (
import.go)fetchOCISkeletonnow looks for<name>-<arch>.tarbefore falling back to<name>.tar, so each arch variantof a component resolves to its own layer in the OCI skeleton.
Related Issue
Fixes #4446
Testing
Unit tests (
src/pkg/packager/load/import_test.go):TestResolveImportsVariantDimensions: verifies that skippingVariantArchitectureincludes both amd64 and arm64variants; amd64/arm64 filters each include only their respective variant.
TestCompatibleComponent: new cases covering skip-arch-only, skip-flavor-only, and skip-all-filters, ensuringeach dimension works independently and in combination.
Local end-to-end test against the zarf source itself (which has both k3s and zarf-injector as two-variant multi-arch
components):
./dist/zarf-fixed package publish . oci://localhost:5001 --plain-http --skip-version-check./dist/zarf-fixed package inspect definition oci://localhost:5001/init:unset-development-only --plain-http -a skeletonPublished skeleton contains both amd64 and arm64 variants of k3s and zarf-injector.
metadata.architecture: skeletonis set correctly.
Backwards compatibility
fetchOCISkeletonfalls back from<name>-<arch>.tarto<name>.tarwhen the arch-specific layer is absent.Skeletons published before this fix continue to work; they just can't provide the previously-missing arch variants.
Checklist before merging