-
-
Notifications
You must be signed in to change notification settings - Fork 763
Labels
area: variablesChanges related to variables.Changes related to variables.
Description
Description
I have multiple taskfiles that use the following pattern to factorize global variables that are expensive to initialize:
version: "3"
vars:
FOO:
sh: |-
echo {{ if .TASK | contains "bar"}}baz{{end}}
tasks:
bar:
cmd: echo {{.FOO}}This worked fine in 3.41.0:
❯ task bar
task: [bar] echo baz
bazNow in version 3.42, I get the following error:
❯ task bar
template: :1:28: executing "" at <"bar">: invalid value; expected stringWhich suggests that the TASK variable is not a string.
But if I do this:
version: "3"
vars:
FOO:
sh: |-
echo {{.TASK}}
tasks:
bar:
cmd: echo {{.FOO}}…then the value of the variable is printed:
❯ task bar
task: [bar] echo bar
barNot sure what's going on here.
Maybe I'm using the variables in an unexpected way.
Version
3.42
Operating system
Ubuntu 22.04
Experiments Enabled
No response
Example Taskfile
version: "3"
vars:
FOO:
sh: |-
echo {{ if .TASK | contains "bar"}}baz{{end}}
tasks:
bar:
cmd: echo {{.FOO}}Metadata
Metadata
Assignees
Labels
area: variablesChanges related to variables.Changes related to variables.