Documentation
¶
Overview ¶
Package templates provides CI summary template loading and rendering.
Index ¶
- func ContainerDefaults() fs.FS
- func RenderReport(atmosConfig *schema.AtmosConfiguration, name string, data any) (string, error)
- type Loader
- func (l *Loader) Load(componentType, command string, defaultTemplates fs.FS) (string, error)
- func (l *Loader) LoadAndRender(componentType, command string, defaultTemplates fs.FS, ctx any) (string, error)
- func (l *Loader) Render(templateContent string, ctx any) (string, error)
- func (l *Loader) RenderStrict(templateContent string, ctx any) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerDefaults ¶
ContainerDefaults returns the embedded default templates for the container component. Pass the result to Loader.LoadAndRender with component type "container" and command "image".
func RenderReport ¶
RenderReport renders a report template for script-authored summaries and comments. The name is a file name under ci.templates.base_path (or an absolute path), and data is the template context. When no file has exactly that name, the name with a .md suffix is tried.
A relative ci.templates.base_path resolves against the Atmos base_path (not the repository root or the working directory). There is no configured default template: callers always pass the name. A key missing from the data fails the render and names the key.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads CI templates with layered override support.
func NewLoader ¶
func NewLoader(atmosConfig *schema.AtmosConfiguration) *Loader
NewLoader creates a new template loader.
func (*Loader) Load ¶
Load returns template content for a component type and command. Override precedence: 1. Explicit file from config (e.g., ci.templates.terraform.plan) 2. Convention-based file from base_path (e.g., {base_path}/terraform/plan.md) 3. Embedded default from provider.
func (*Loader) LoadAndRender ¶
func (l *Loader) LoadAndRender(componentType, command string, defaultTemplates fs.FS, ctx any) (string, error)
LoadAndRender loads a template and renders it with the given context.