Skip to content

Commit

Permalink
docs: document cmd template function (#8929)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzzzzzzz authored Jul 5, 2023
1 parent 9f618df commit 68cc5f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs-v2/content/en/docs/environment/templating.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ List of variables that are available for templating:
* `IMAGE_NAME2`, `IMAGE_REPO2`, `IMAGE_TAG2`, `IMAGE_DIGEST2` - the 2nd artifact's image name, tag, and sha256 digest
* `IMAGE_NAME2`, `IMAGE_REPON`, `IMAGE_TAGN`, `IMAGE_DIGESTN` - the Nth artifact's image name, tag, and sha256 digest

Default values can be specified using the `{{default "bar" .FOO}}` expression syntax, which results in "bar" if .FOO is nil or a zero value.
### Template functions
Besides the [built-in template functions](https://pkg.go.dev/text/template) in golang, skaffold also provides the following ones:
- `default` : Default values can be specified using the `{{default "bar" .FOO}}` expression syntax, which results in "bar" if .FOO is nil or a zero value.
- `cmd`: This allows users to use the result from external commands in template, for example `{{cmd "bash" "-c" "xxx xxx xxx"}}` can be used to execute bash script and get the result into the template.

0 comments on commit 68cc5f9

Please sign in to comment.