templates

package
v1.233.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package templates provides CI summary template loading and rendering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerDefaults

func ContainerDefaults() fs.FS

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

func RenderReport(atmosConfig *schema.AtmosConfiguration, name string, data any) (string, error)

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

func (l *Loader) Load(componentType, command string, defaultTemplates fs.FS) (string, error)

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.

func (*Loader) Render

func (l *Loader) Render(templateContent string, ctx any) (string, error)

Render renders a template with the given context. A missing map key renders as "<no value>", which native plugin templates rely on; script-authored report templates use RenderStrict.

func (*Loader) RenderStrict

func (l *Loader) RenderStrict(templateContent string, ctx any) (string, error)

RenderStrict renders a template and fails on a missing map key, naming the key, so a typo in a script's data keys or a template placeholder cannot silently render "<no value>".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL