Templates

YAML tags for templates block

The template tag is intended to be used to identify where to retrieve templates during the compiler phase of the pipeline.

---
# This document is displaying all the required tags
# to pull a template from a remote system.
templates:
  - name: example
    source: github.com/go-vela/templates/example.yml
    type: github    

Tags

TagRequiredTypeDescription
nameYstringindicates a unique identifier for the template.
sourceYstringindicates a path to a template in remote system.
typeYstringindicates to the compiler which version to use.
formatNstringindicates the language used within the template file.

Usage

The name: tag

templates:
    # Indicates a unique identifier for the template. This identifier
    # then can be used within a step to expand the template.
  - name: example

The source: tag

templates:
    # Indicates a path to a template in remote system. This path
    # should always be the raw path within a repository. By default 
    # the template is pulled from the default branch on the repository.
    # It can be overwritten by adding a suffix of "@<branch>".
    source: github.com/go-vela/templates/example.yml@testbranch
templates:
    # As an alternative, if the template is within the same repository,
    # the source can be the path to the template in the Vela workspace.
    # This is used in conjunction with `type: file`.
    source: path/to/template.yml

The type: tag

templates:
    # Indicates to the compiler which version to use.
    type: github
templates:
    # The 'file' type will grab a template from the repository on a commit.
    type: file

The format: tag

templates:
  - name: example
    source: github.com/go-vela/templates/example.yml
    type: github
    # Indicates the language used within the template file. By default
    # the template will be "go" but accepts the following values: go, golang, starlark
    format: starlark