You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`json` filter: Output a value as a JSON object. `{{ myVar|json }}`
81
-
*`base64` filter: Output a value as a Base64 encoded string. `{{ myVar|base64 }}`
82
-
83
-
**IMPORTANT**: If your Jinja template is intended to return a list, map or
84
-
object graph, you must ensure the output is *valid YAML or JSON*.
54
+
# Explained in Pictures
55
+

85
56
86
57
# Template & Configuration Schemas
87
58
@@ -96,7 +67,7 @@ UI. **NOTE:** This stanza, while defined in the spec, is not currently consumed
96
67
by Spinnaker itself.
97
68
98
69
This section primarily gives explanations of Templates & Configurations. For
99
-
actual reference schemas, please take a look at [schemas/pipeline-templates-v1](schemas/pipeline-templates-v1).
70
+
actual reference schemas, please take a look at [schemas/pipeline-templates-v1](schemas/pipeline-templates-v1). For examples, please take a look at [examples/pipeline-templates-v1](examples/pipeline-templates-v1).
100
71
101
72
## Templates
102
73
@@ -210,6 +181,41 @@ When using the *spinnaker scheme*, it's recommended to namespace your template
210
181
IDs, as they are globally unique, regardless of the scope you provide them while
211
182
publishing.
212
183
184
+
# Jinja Templating
185
+
186
+
Templates can use jinjava (Java implementation of Jinja) to offer greater
187
+
productivity while creating and using templates. Jinja templating is only
188
+
allowed in string values so that the JSON transport can always be valid. The
189
+
results of Jinja templates can and often will result in non-string values (even
190
+
object graphs).
191
+
192
+
For more information about what's possible with Jinja, and specifically jinjava:
193
+
194
+
* https://github.com/HubSpot/jinjava
195
+
* http://jinja.pocoo.org/docs/2.9/ (Python implementation; good reference)
196
+
197
+
Jinja is supported in the following areas:
198
+
199
+
* Stage & module `when` stanzas
200
+
* Module `definition` stanza (or any nested value inside)
201
+
* Stage `config` stanza (or any nested value inside)
202
+
* Stage `name` stanza
203
+
* Template `metadata` values
204
+
205
+
## Custom Tags & Filters
206
+
207
+
We're continually extending the Jinja implementation with new Tags and Filters.
208
+
209
+
* `frigga` filter: Used to parse string values and return Frigga naming
# This example shows a bake and deploy pipeline with the option to override to a find image and deploy pipeline
2
+
The UI view for this pipeline is shown in [complex-wait-ui.png](complex-wait-ui.png). Same UI for all three options.
3
+
4
+
## Option 1: Bake
5
+
`template.yml` shows a sample multi region bake and deploy. `bake-deploy-config.yml` shows the config for that pipeline, providing a stage name for the first stage.
6
+
7
+
8
+
## Option 2: Find Image
9
+
`template.yml` remains the same. `findImage-deploy-config.yml` shows replacing the bake stage with a findImage stage.
The UI view for this pipeline is shown in [complex-wait-ui.png](complex-wait-ui.png). Same UI for all three options.
3
+
4
+
## Option 1: Inheritance
5
+
`root-template.yml`, `child-template.yml`, and `child-2-template.yml` show an inheritence structure and the use variable. `mypipeline-config.yml` adds another stage at the configuration level.
6
+
7
+
8
+
## Option 2: One template
9
+
`combined-template.yml` shows the same stages represented in one template. `mypipelineCombined-config.yml` shows the config for that template that produces the same pipeline.
10
+
11
+
## Option 3: All Config
12
+
`only-config.yml` shows how you can create the same pipeline with one config file. You might want to do this if you are only using this logic for one pipeline, or you are working to transition to managed pipeline templates and want to first convert each pipeline to code.
0 commit comments