Repository navigation
docs: clarify bundle values and variables - #1457
Conversation
Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com>
65dc92c to
f59d66f
Compare
Greptile SummaryThis PR resolves templates recursively within structured Helm values before JSON encoding, preserving quoted and escaped contents while detecting resolved map-key collisions. It also propagates package-preview override errors without exposing resolved values and clarifies recommended use of static values, runtime variables, sensitive variables, and file variables.
Confidence Score: 5/5The PR appears safe to merge, with the changed template-resolution and preview-error paths covered by focused tests and no actionable defects identified. Structured templates are resolved before JSON serialization without mutating source values, key collisions are rejected, unavailable preview imports remain unresolved rather than becoming empty, and propagated errors retain useful location context while avoiding disclosure of resolved values. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Bundle chart overrides] --> B[Load available variables]
B --> C[Process value overrides]
C --> D{Structured value?}
D -->|Map or list| E[Recursively substitute strings and map keys]
E --> F{Resolved key collision?}
F -->|Yes| G[Return contextual error]
F -->|No| H[JSON encode resolved structure]
D -->|Scalar| I[Substitute scalar template]
H --> J[Merge Helm values]
I --> J
J -->|Success| K[Chart override map]
J -->|Failure| L[Return redacted contextual error]
Reviews (1): Last reviewed commit: "fix: preserve templated object values" | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
This PR fixes templated variable substitution for structured Helm overrides by resolving templates inside nested maps/lists before JSON encoding, preventing quotes/backslashes from corrupting JSON and avoiding accidental leakage of resolved values via Helm parse errors. It also tightens error propagation during preview generation and updates the bundle override guide to better distinguish static values vs deploy-time variables.
Changes:
- Recursively substitutes templated string leaves (and templated map keys) in nested override values prior to JSON marshaling; rejects templated key collisions.
- Propagates override-processing errors in
formPkgViewsWithMetadata(preview) instead of ignoring them, and avoids including resolved values in Helm merge errors. - Adds regression tests for quote/backslash preservation, templated map keys, collision handling, and preview error propagation; clarifies docs guidance around values/variables/sensitive/file variables.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/pkg/bundle/overrides.go | Resolves templates in structured overrides before JSON encoding; improves context wrapping for override processing and redacts Helm merge errors. |
| src/pkg/bundle/overrides_test.go | Adds regression tests covering nested map/list substitutions, templated keys, collision rejection, and preview error propagation/redaction. |
| src/pkg/bundle/deploy.go | Ensures preview/package view generation propagates chart override processing errors. |
| docs/how-to-guides/use-bundle-overrides.mdx | Clarifies guidance on static values vs deploy-time variables, plus sensitive: true and type: file usage. |
π‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
chance-coleman
left a comment
There was a problem hiding this comment.
few small comments, generally looking good
Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com>
Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com>
Description
Clarify the intended bundle override model:
valuesfor static configuration set at bundle creation.variablesfor configuration supplied or changed at deploy time.sensitive: true.type: filewhen exact literal contents, including backslashes, must be preserved.Includes a migration example. No code changes.
Related Issue
Related to #1456
Validation
uds run docs:testgit diff --check origin/main...HEAD