-
-
Notifications
You must be signed in to change notification settings - Fork 763
Open
Labels
state: needs triageWaiting to be triaged by a maintainer.Waiting to be triaged by a maintainer.
Description
Description
in a for loop cmd, the loop variable cannot be passed using .ref method
this works:
for:
var: any_iterable
as: this
task: process
vars:
thing: '{{ .this }}'This does not:
for:
var: any_iterable
as: this
task: process
vars:
thing:
ref: .thisVersion
3.45.4
Operating system
linux
Experiments Enabled
No response
Example Taskfile
version: 3
silent: true
vars:
global_var: global
any_iterable: some thing
tasks:
process:
vars:
thing:
ref: default "undefined" .thing
cmd: echo '{{ .thing }}'
default:
cmds:
- task: cannot-pass-loop-variable--by-ref
- task: cannot-pass-loop-variable--by-ref-default-name
- task: cannot-pass-loop-variable--default-by-caller-does-not-see-it
- task: can-pass-variable-by-ref
- task: can-pass-loop-variable--by-template
can-pass-variable-by-ref:
cmds:
- echo '[!!!] no loop | using .ref with a global variable'
- task: process
vars:
thing:
ref: .global_var
cannot-pass-loop-variable--by-ref-default-name:
cmds:
- echo '[!!!] loop | using .ITEM'
- for:
var: any_iterable
task: process
vars:
thing:
ref: .ITEM
cannot-pass-loop-variable--by-ref:
cmds:
- echo '[!!!] loop | using varible alias'
- for:
var: any_iterable
as: this
task: process
vars:
thing:
ref: .this
can-pass-loop-variable--by-template:
cmds:
- echo '[!!!] loop | using template'
- for:
var: any_iterable
as: this
task: process
vars:
thing: '{{ .this }}'
cannot-pass-loop-variable--default-by-caller-does-not-see-it:
cmds:
- echo '[!!!] loop | setting fallback on (invoker) task'
- for:
var: any_iterable
as: this
task: process
vars:
thing:
ref: default "invoker_default" .thisMetadata
Metadata
Assignees
Labels
state: needs triageWaiting to be triaged by a maintainer.Waiting to be triaged by a maintainer.