Repository navigation
Conversation
Binary size
|
a1994sc
marked this pull request as ready for review
November 8, 2026 03:43
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
Signed-off-by: Allen Conlon <software@conlon.dev>
a1994sc
force-pushed
the
feature/rendor
branch
from
November 8, 2026 03:51
ae2b227 to
2fb9b63
Compare
This branch has not been deployed
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
Package definitions were generated in exactly one place - the mage-only example generator under
magefiles/pkg/gen/examples/, which renders the committed examples underexample/and is reachable from nothing else - so an operator who wanted a template plus a values file per release had to fork this repository or hand-write everydistro.yaml. The rendering core moves intopkg/distrogenand is shared: mage keeps its pins, tags, flavors, caches and probes, andcargoship dev renderexposes the same generator against values an operator supplies.One generator, four call sites collapsed
pkg/distrogenisRender,Write,CheckOutputsandValidateDistro, rendering through the existinghelmvalues.RenderTemplateso there is no second template engine. The four duplicated render sites inmagefiles/pkg/gen/examples/-parseExampleTemplate,writeExampleValues,writeExampleContentManifestsandparseUpstreamTemplate- now call it, and the first, second and fourth are deleted. Rendering and writing stay separate steps becausecontent.goneeds the bytes first, to drop a manifest that turns out to declare nothing.Behaviour preserved, and one behaviour changed
The example templates now render under sprig with
helmvalues.FuncMaprather than baretext/template, with the digest helpers injected through a newhelmvalues.WithFuncsoption.generate:examplesproduces a byte-identicalexample/tree, including main'sk3s-ociflavor, which is the acceptance test for the refactor. What does change:helmvalues.RenderTemplaterejects a template that resolved a key to<no value>, so a key absent for a new tag now failsgenerate:exampleLinerather than rendering that literal into a file. Better behaviour, but a new failure mode on the refresh path. Separately,Writeis not atomic - a mid-loop write error leaves a partial directory - while validation does gate every write.Tests
pkg/distrogencovers output naming, injected funcs, the missing-key rejection, directory creation, schema validation, andCheckOutputs- which refuses to render a template onto itself (dev render -t ./distro.yamlwith no--outoverwrote the template with its own output), refuses two templates colliding on one output name, and refuses a name that would escape--out.cmd/dev_render_test.gocovers writing, validation blocking the write,--no-validate, values merge order, template clobbering, and the line printed when nodistro.yamlwas rendered and so nothing was schema-checked.go test -short ./api/... ./cmd/... ./config/... ./internal/... ./pkg/... ./types/...and./magefiles/pkg/gen/examples/pass,go run ./magefiles/core generate:examplesleavesexample/unchanged,prek run --all-filesis clean, andmdbook buildreports no warnings.mage build:binarymoves the linux/amd64 binary by 8 KiB, 39.77 to 39.89 MiB, sincehelmvalues,pkg/schemaandgoccy/go-yamlwere already linked.Related Issue
Relates to N/A
Checklist before merging