Skip to content

Templating

For advanced purposes, Go templating is supported in pipeline definition files. This feature is particularly useful for avoiding the need to write repetitive pipeline definitions.

To enable this feature for a file, append the extension .tmpl to its name (e.g. /.reeve.yaml.tmpl). Files with the .tmpl extension must be valid Go templates, and can use sprig template functions.

When importing a template into another file, arbitrary parameters can be passed into the template. Those parameters are available as the value of dot, e.g.:

yaml
---
type: include
name: /test.yaml.tmpl
templateData:
  var: Name
  val: Value
yaml
---
type: variable
name: "{{ .var }}"
value: "{{ .val }}"

CAVEAT

The parameters are passed to the template unchanged, that is, they are not escaped in any way. You must ensure that the result of the template is valid YAML, e.g., by using the toJson function.

yaml
{{ toJson .val }}