-
-
Notifications
You must be signed in to change notification settings - Fork 763
Labels
area: variablesChanges related to variables.Changes related to variables.
Description
Before v3.40.0, when passing a variable into another variable using the ref attribute, undefined and null variables were treated as empty lists. Now, they seem to be treated as empty strings. Which is the expected behavior?
Taskfile that illustrates the problem
version: "3"
vars:
EMPTY_LIST_VAR: []
EMPTY_STR_VAR: ""
NULL_VAR: null
tasks:
loop_and_echo_var:
cmd: >-
{{range .ECHO_VAR}}
echo {{.}}
{{end}
test1:
cmds:
- echo "UNDEFINED_VAR"
- task: loop_and_echo_var
vars:
ECHO_VAR:
ref: ".UNDEFINED_VAR"
test2:
cmds:
- echo "EMPTY_LIST_VAR"
- task: loop_and_echo_var
vars:
ECHO_VAR:
ref: ".EMPTY_LIST_VAR"
test3:
cmds:
- echo "EMPTY_STR_VAR"
- task: loop_and_echo_var
vars:
ECHO_VAR:
ref: ".EMPTY_STR_VAR"
test4:
cmds:
- echo "NULL_VAR"
- task: loop_and_echo_var
vars:
ECHO_VAR:
ref: ".NULL_VAR"With task v3.39.0, I get the following output for each task:
> task -t bug-repro-tasks.yaml test1
task: [test1] echo "UNDEFINED_VAR"
UNDEFINED_VAR
> task -t bug-repro-tasks.yaml test2
task: [test2] echo "EMPTY_LIST_VAR"
EMPTY_LIST_VAR
> task -t bug-repro-tasks.yaml test3
task: [test3] echo "EMPTY_STR_VAR"
EMPTY_STR_VAR
task: Failed to run task "test3": template: :1:8: executing "" at <.ECHO_VAR>: range can't iterate over
> task -t bug-repro-tasks.yaml test4
task: [test4] echo "NULL_VAR"
NULL_VARWith task v3.40.0, I get the following output for each task:
> task -t bug-repro-tasks.yaml test1
task: [test1] echo "UNDEFINED_VAR"
UNDEFINED_VAR
task: Failed to run task "test1": template: :1:8: executing "" at <.ECHO_VAR>: range can't iterate over
> task -t bug-repro-tasks.yaml test2
task: [test2] echo "EMPTY_LIST_VAR"
EMPTY_LIST_VAR
> task -t bug-repro-tasks.yaml test3
task: [test3] echo "EMPTY_STR_VAR"
EMPTY_STR_VAR
task: Failed to run task "test3": template: :1:8: executing "" at <.ECHO_VAR>: range can't iterate over
> task -t bug-repro-tasks.yaml test4
task: [test4] echo "NULL_VAR"
NULL_VAR
task: Failed to run task "test4": template: :1:8: executing "" at <.ECHO_VAR>: range can't iterate over- Task version: 3.40.0
- Operating system: Ubuntu 22.04
- Experiments enabled: None
Metadata
Metadata
Assignees
Labels
area: variablesChanges related to variables.Changes related to variables.