Templates

About

Many of the input fields for the CLI support using template strings. This allows Tugboat input options to be evaluated dynamically when working with an image.

Template Keys

The following table of values are available to call.

KeyDescription
.ImageNameThe value from image.name
.VersionThe value derived from image.version
.ShortCommitThe git commit short hash
.FullCommitThe git commit full hash
.BranchThe current git branch
.TagThe current git tag

Image Tagging

Image tagging can be defined dynamically using templates in the the configuration file. The build.tags option can be defined using supported template fields.

Given the following tugboat.yaml file for example:

image:
  name: gotugboat/my-image
  version: v1.0.0
build:
  tags:
    - '{{.ImageName}}:{{.Version}}'

The resulting image generated from running tugboat build would be docker.io/gotugboat/my-image:amd64-v1.0.0.