Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update templates for starlark and go (#201)
- Loading branch information
1 parent
5e65ecd
commit b829e28
Showing
18 changed files
with
942 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: "Go" | ||
linkTitle: "Go" | ||
description: > | ||
See examples on how to write Go templates. | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: "Platform Vars" | ||
linkTitle: "Platform Vars" | ||
description: > | ||
Example Go template with platform vars. | ||
--- | ||
|
||
{{% alert color="note" %}} | ||
We recommend reviewing [Go Templates documentation](https://golang.org/pkg/text/template/) before attempting to create a template. | ||
|
||
If you're new to YAML we also recommend reviewing the [YAML 1.2 spec](https://yaml.org/spec/1.2/spec.html) for validation on syntax. | ||
{{% /alert %}} | ||
|
||
## Overview | ||
|
||
Platform variables can be referenced with the following syntax: | ||
|
||
`{{ vela "<environment variable>" }}` | ||
|
||
## Examples | ||
|
||
- `{{ vela "VELA_FULL_REPO_NAME" }}` equates to the `VELA_FULL_REPO_NAME` environment variable | ||
- `{{ vela "FULL_REPO_NAME" }}` equates to the `VELA_REPO_NAME` environment variable | ||
- `{{ vela "VELA_BUILD_NUMBER" }}` equates to the `VELA_BUILD_NUMBER` environment variable | ||
- `{{ vela "VELA_ADDR" }}` equates to the `VELA_ADDR` environment variable | ||
|
||
## Sample | ||
|
||
Let's take a look at using a platform variable in a template: | ||
|
||
```yaml | ||
metadata: | ||
template: true | ||
|
||
steps: | ||
- name: test | ||
commands: | ||
- echo {{ vela "VELA_REPO_FULL_NAME" }} | ||
image: alpine | ||
pull: always | ||
ruleset: | ||
event: [ push, pull_request ] | ||
``` | ||
|
||
The caller of this template could look like: | ||
|
||
```yaml | ||
version: "1" | ||
templates: | ||
- name: sample | ||
source: github.com/<org>/<repo>/path/to/file/<template>.yml | ||
type: github | ||
|
||
steps: | ||
- name: sample | ||
template: | ||
name: echo | ||
``` | ||
|
||
Which means the compiled pipeline for execution on a worker is: | ||
|
||
```yaml | ||
version: "1" | ||
steps: | ||
- name: sample_echo | ||
commands: | ||
- echo github/octocat | ||
image: alpine | ||
pull: always | ||
ruleset: | ||
event: [ push, pull_request ] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: "Starlark" | ||
linkTitle: "Starlark" | ||
description: > | ||
See examples on how to write Starlark templates. | ||
--- |
Oops, something went wrong.