change template delimiters

changed delimiters from "{{", "}}" to "{{+", "+}}", to avoid parsing the vault templates

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-05-08 22:31:09 +05:30
parent 6ff9524210
commit f58a33b0d8
2 changed files with 5 additions and 5 deletions

View File

@@ -43,9 +43,9 @@ like a version on the fly.
#### Parameters
* `job_path`: (required) Path of the HCL job file to run
* `vars`: { [key: string]: string } dictionary of variables to substitute in the job file. Each key
should be represented in the job file as `{{.key}}`
should be represented in the job file as `{{+.key+}}`
* `var_files`: { [key: string]: string } dictionary of paths to files to read to get variable
values. Each key should be represented in the job file as `{{.key}}` and the values should be path
values. Each key should be represented in the job file as `{{+.key+}}` and the values should be path
to text files which content will be used as the variable value. Whitespace and trailing newlines
will be trimmed from the value.
* `templating`: { bool }: Whether to use templating or not. `true` by default
@@ -103,10 +103,10 @@ job "sample" {
driver = "docker"
config {
image = "cioplenu/sample:{{.version}}"
image = "cioplenu/sample:{{+.version+}}"
auth = {
username = "some-username"
password = "{{.registry_token}}"
password = "{{+.registry_token+}}"
}
force_pull = true
}

View File

@@ -48,7 +48,7 @@ func main() {
templFile, err := ioutil.ReadFile(templPath)
common.Check(err, "Could not read input file "+templPath)
if config.Params.Templating != false {
tmpl, err := template.New("job").Parse(string(templFile))
tmpl, err := template.New("job").Delims("{{+", "+}}").Parse(string(templFile))
common.Check(err, "Error parsing template")
for name, path := range config.Params.VarFiles {