Skip to content

feat(values)!: support schema merge on imports#4951

Merged
brandtkeller merged 12 commits into
mainfrom
4877_package_values_schema_merge
Jun 4, 2026
Merged

feat(values)!: support schema merge on imports#4951
brandtkeller merged 12 commits into
mainfrom
4877_package_values_schema_merge

Conversation

@brandtkeller
Copy link
Copy Markdown
Member

@brandtkeller brandtkeller commented May 29, 2026

Description

Support importing child package values schemas and merging them during package create for local import paths only. Skeleton values support will follow. Given that we do not want to modify the source parent schema as we process imports and it not being a list - I've proposed the current strategy:

Updating the function parameters and adding an intermediary type DefinedPackage to support a proper handoff between the require packages.

I had originally created an exported field ImportedSchemas which is used to track schemas during the import resolution process for access during AssemblePackage(). I felt like this modified the public API in an inappropriate way.

This does take a stance on not allowing the use of $refs as they create concerns for availability of the referenced files and I figured an explicit error would be better than trying to handle them outside of the schema. This means the schemas used are required to be flat.

Related Issue

Fixes #4877

Checklist before merging

Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit c5c4ca0
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a205cafa5a1ee000816bb94

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 64.45183% with 107 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/packager/layout/assemble.go 50.00% 28 Missing and 26 partials ⚠️
src/pkg/packager/load/import.go 44.73% 16 Missing and 5 partials ⚠️
src/pkg/packager/load/load.go 36.84% 9 Missing and 3 partials ⚠️
src/pkg/packager/dev.go 0.00% 7 Missing ⚠️
src/cmd/dev.go 0.00% 3 Missing ⚠️
src/pkg/value/schema.go 96.90% 2 Missing and 1 partial ⚠️
src/pkg/value/value.go 50.00% 2 Missing and 1 partial ⚠️
src/pkg/packager/layout/package.go 60.00% 2 Missing ⚠️
src/pkg/packager/deploy.go 0.00% 1 Missing ⚠️
src/pkg/packager/inspect.go 66.66% 0 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/pkg/packager/create.go 54.08% <100.00%> (ø)
src/pkg/packager/find_images.go 57.95% <100.00%> (ø)
src/pkg/packager/lint.go 62.50% <100.00%> (ø)
src/pkg/packager/publish.go 63.10% <100.00%> (ø)
src/pkg/packager/deploy.go 3.98% <0.00%> (ø)
src/pkg/packager/inspect.go 41.79% <66.66%> (-11.42%) ⬇️
src/pkg/packager/layout/package.go 40.74% <60.00%> (-29.64%) ⬇️
src/cmd/dev.go 43.18% <0.00%> (ø)
src/pkg/value/schema.go 96.90% <96.90%> (ø)
src/pkg/value/value.go 77.02% <50.00%> (-1.74%) ⬇️
... and 4 more

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Comment thread src/pkg/value/schema.go Fixed
Comment thread src/pkg/value/schema.go Fixed
Comment thread src/pkg/value/schema.go Fixed
Comment thread src/pkg/value/schema.go Fixed
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
@brandtkeller brandtkeller marked this pull request as ready for review June 1, 2026 23:45
@brandtkeller brandtkeller requested review from a team as code owners June 1, 2026 23:45
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Copy link
Copy Markdown
Member

@AustinAbro321 AustinAbro321 left a comment

Choose a reason for hiding this comment

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

Glad to see this moving along, poked at it and found some bugs / decision points

Comment thread src/pkg/packager/load/import.go
Comment thread src/pkg/packager/layout/assemble.go Outdated
Comment thread src/pkg/value/schema.go
Comment thread src/pkg/value/schema.go
Comment thread src/pkg/value/schema.go Outdated
@github-project-automation github-project-automation Bot moved this to In progress in Zarf Jun 2, 2026
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Copy link
Copy Markdown
Member

@AustinAbro321 AustinAbro321 left a comment

Choose a reason for hiding this comment

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

looks close, a few more comments

Comment thread src/pkg/value/schema.go
Comment thread src/pkg/packager/layout/assemble.go
@AustinAbro321
Copy link
Copy Markdown
Member

Could you also mark this PR with a "!" and note the breaking changes in load in the description

@brandtkeller brandtkeller changed the title feat(values): support schema merge on imports feat(values)!: support schema merge on imports Jun 3, 2026
Signed-off-by: Brandt Keller <brandt.keller@defenseunicorns.com>
Copy link
Copy Markdown
Member

@AustinAbro321 AustinAbro321 left a comment

Choose a reason for hiding this comment

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

LGTM, we should document the behavior (merge for "properties, "definitions", ...) and overwrite for others, but lets do that in a follow up

@brandtkeller brandtkeller added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 9c79597 Jun 4, 2026
31 of 32 checks passed
@brandtkeller brandtkeller deleted the 4877_package_values_schema_merge branch June 4, 2026 04:45
@github-project-automation github-project-automation Bot moved this from In progress to Done in Zarf Jun 4, 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.

Merge values schema during component import

3 participants