-
-
Notifications
You must be signed in to change notification settings - Fork 668
Defer no longer supporting passing vars (not interpolation) #1909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've encountered a similar issue using 3.41.0 on Win10
if I run
and this is fine and it is what I was expecting.
Basically, variables that are passed to a task from another task are ignored by the defer, and this seems the same problem @toby-griffiths was experiencing. |
I think it doesn't respect any vars defined in the task itself.
Running
|
Still broken in 3.42.1. Taskfile.yml: version: '3'
tasks:
foo:
cmds:
- 'echo "foo: {{.FOO}}"'
- defer:
task: bar
vars: {BAR: 'defer: {{.FOO}}'}
- task: bar
vars: {BAR: 'direct: {{.FOO}}'}
vars:
FOO: "foobar"
bar:
cmds:
- 'echo "bar: {{.BAR}}"' Execution: $ task foo
task: [foo] echo "foo: foobar"
foo: foobar
task: [bar] echo "bar: direct: foobar"
bar: direct: foobar
task: [bar] echo "bar: defer: "
bar: defer: |
Confirmed that the break came from v3.39.0: version: '3'
tasks:
parent:
vars:
VAR1: "value-from-parent"
cmds:
- defer:
task: child
vars:
VAR1: 'task deferred {{.VAR1}}'
- task: child
vars:
VAR1: 'task immediate {{.VAR1}}'
child:
cmds:
- cmd: echo "child {{.VAR1}}" Output comparison from 3.38.0 to 3.39.0: $ go run github.com/go-task/task/v3/cmd/[email protected] parent # working
task: [child] echo "child task immediate value-from-parent"
child task immediate value-from-parent
task: [child] echo "child task deferred value-from-parent"
child task deferred value-from-parent
$ go run github.com/go-task/task/v3/cmd/[email protected] parent # broken
task: [child] echo "child task immediate value-from-parent"
child task immediate value-from-parent
task: [child] echo "child task deferred "
child task deferred |
We are using for loops to deploy things for a list of tenants, but for some reason the deferred command is missing any vars interpolated into the vars of the deferred task.
Example…
Results in …
You'll see from this example that the regular commands display the names, but the deferred ones do not.
If you interpolate into a direct command, rather than a task this works fine…
Resulting in…
The text was updated successfully, but these errors were encountered: