Documentation
¶
Overview ¶
Package distrogen renders package definitions - a distro.yaml and whatever files sit beside it - from Go templates.
It is the generator both callers share: `cargoship dev render`, where an operator brings their own template and a values file, and mage's example targets, which derive their data from engine pins and render the committed examples under example/. The templates are evaluated with the same function map a package's own values templates get (pkg/helmvalues), so a template written for one renders the same way in the other.
Rendering and writing are separate steps because a caller may need the bytes first: the example generator drops a rendered content manifest that turns out to declare nothing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckOutputs ¶
CheckOutputs reports whether rendering files into dir would write somewhere it must not.
Two of these have eaten a file in practice. An output that lands on one of the templates being rendered overwrites it with its own output - `dev render -t ./distro.yaml` with no --out is the whole of it, since reading happens before writing and nothing fails. Two templates whose names collide write to one path, and the first result is lost behind the second while both are reported as rendered.
Called before Render rather than before Write so that nothing is read, let alone written, when the request cannot be satisfied.
func ValidateDistro ¶
ValidateDistro checks rendered bytes against the generated package schema, the same check `cargoship validate` applies to a definition already on disk. source names the document in the problems it reports.
Types ¶
type File ¶
type File struct {
Template string // path to the template
Name string // output name; "" means the template's base name without .tmpl
}
File is one template and the name it renders to.
func (File) OutputName ¶
OutputName is the name a file renders to: what it declares, or its template's base name without the .tmpl suffix.