Skip to main content

CI Templates

The ci.templates section configures custom Markdown templates for job summaries and PR comments. Templates use Go template syntax with access to plan/apply context data.

Experimental

Configuration

atmos.yaml
ci:
templates:
base_path: ".atmos/ci/templates"
terraform:
plan: "plan.md"
apply: "apply.md"
helm:
template: "helm-template.md"
diff: "helm-diff.md"
apply: "helm-apply.md"
delete: "helm-delete.md"
helmfile:
template: "helmfile-template.md"
diff: "helmfile-diff.md"
apply: "helmfile-apply.md"
destroy: "helmfile-destroy.md"
ci.templates.base_path

Directory containing custom template files, relative to the repository root.

Default: .atmos/ci/templates

ci.templates.terraform.plan

Filename of the custom plan summary template within the base path.

Default: Built-in template

ci.templates.terraform.apply

Filename of the custom apply summary template within the base path.

Default: Built-in template

ci.templates.helm.template
Filename of the custom native Helm template/render summary template within the base path.
ci.templates.helm.diff
Filename of the custom native Helm diff/plan summary template within the base path.
ci.templates.helm.apply
Filename of the custom native Helm apply/deploy summary template within the base path.
ci.templates.helm.delete
Filename of the custom native Helm delete/destroy summary template within the base path.
ci.templates.helmfile.template
Filename of the custom Helmfile template summary template within the base path.
ci.templates.helmfile.diff
Filename of the custom Helmfile diff summary template within the base path.
ci.templates.helmfile.apply
Filename of the custom Helmfile apply/sync/deploy summary template within the base path.
ci.templates.helmfile.destroy
Filename of the custom Helmfile destroy summary template within the base path.

Template Context

Templates receive a context object for the operation being summarized.

All native CI summary templates receive these common fields when available:

VariableTypeDescription
.ComponentstringComponent name
.StackstringStack name
.CommandstringNormalized command name used for template selection
.SuccessboolWhether the operation succeeded
.ExitCodeintCommand exit code
.ErrorstringError message when the command failed
.ReproductionCommandstringLocal command to reproduce the operation

Terraform Plan Template Variables

VariableTypeDescription
.ComponentstringComponent name
.StackstringStack name
.CommandstringTerraform command (plan)
.HasChangesboolWhether the plan has changes
.AdditionsintNumber of resources to create
.ChangesintNumber of resources to change
.DestructionsintNumber of resources to destroy
.ImportsintNumber of resources to import
.SummarystringOne-line plan summary
.ResourcesobjectResource lists by action type
.Warnings[]stringTerraform warning messages

Terraform Apply Template Variables

VariableTypeDescription
.ComponentstringComponent name
.StackstringStack name
.CommandstringTerraform command (apply)
.SuccessboolWhether apply succeeded
.SummarystringOne-line apply summary
.ResourcesobjectResource lists by action type
.OutputsmapTerraform outputs
.Warnings[]stringTerraform warning messages

Helm Template Variables

Native Helm summary templates also receive Helm metadata when available:

VariableTypeDescription
.ReleaseNamestringHelm release name
.NamespacestringKubernetes namespace
.ChartstringChart reference
.TargetstringProvision target, when one was selected
.ObjectCountintNumber of rendered or applied Kubernetes objects
.KindsmapRendered or applied Kubernetes object counts by kind
.ManifestBytesintRendered manifest size in bytes
.DiffstringUnified diff produced by diff/plan (rendered as a collapsible diff block; Secret values redacted)

render uses the template template, plan uses diff, deploy uses apply, and destroy uses delete.

Helmfile Template Variables

Helmfile summary templates also receive captured command output:

VariableTypeDescription
.OutputstringCombined masked stdout/stderr captured from the Helmfile command

sync and deploy use the apply template.

Kubernetes Summary Template Variables

Native Kubernetes components render a single summary template (default name summary) for every command (render, plan, diff, apply, deploy, delete, validate). For plan/diff, the .Diff variable holds the aggregated unified diff of all changed objects (rendered as a collapsible diff block using GitHub's diff fenced code syntax). Secret objects are deliberately omitted from .Diff so their data never reaches the job summary.

VariableTypeDescription
.ComponentstringComponent name
.StackstringStack name
.CommandstringKubernetes command (plan, diff, apply, …)
.Statusstringfailed, changed, no changes, or succeeded
.ObjectsTotalintNumber of objects processed
.Counts[]objectAction counts, each with .Action and .Count
.Actions[]objectPer-object rows: .Action, .Resource, .Namespace, .Name, .Diff
.DiffstringAggregated unified diff across changed objects (Secrets omitted, truncated)
.ErrorstringCommand error message, if any

Customizing the Kubernetes Summary

Kubernetes summaries resolve by the base-path convention rather than the terraform/helmfile override maps. Place a file at <base_path>/kubernetes/summary.md to override the embedded default, or set ci.summary.template to load a different template name from <base_path>/kubernetes/<name>.md.

atmos.yaml
ci:
templates:
base_path: ".atmos/ci/templates" # kubernetes summary read from kubernetes/summary.md
summary:
template: "summary" # optional: load kubernetes/<template>.md instead

Example Custom Template

.atmos/ci/templates/plan.md
## {{ .Component }} / {{ .Stack }}

{{ if .HasChanges }}
**Changes detected:** {{ .Additions }} to add, {{ .Changes }} to change, {{ .Destructions }} to destroy

{{ if gt .Destructions 0 }}
> **Warning:** This plan destroys resources!
{{ end }}
{{ else }}
No changes. Infrastructure is up-to-date.
{{ end }}

Built-in Templates

The default templates are embedded in the Atmos binary:

  • Terraform: pkg/ci/plugins/terraform/templates/
  • Helm: pkg/ci/plugins/helm/templates/
  • Helmfile: pkg/ci/plugins/helmfile/templates/
  • Kubernetes: pkg/ci/plugins/kubernetes/templates/

You can use these as a starting point for customization.