The behavior of TASKFILE_DIR has changed when using assignment in include variables.
Having two task files:
caller/demo/caller_Taskfile.yml
version: "3"
includes:
myinc:
taskfile: ../../include_Taskfile.yml
internal: true
vars:
PATH: "{{.TASKFILE_DIR}}". ### < This is getting set to the path ../../include_Taskfile.yml is in. :(
tasks:
pathvars:
desc: Show Path
deps:
- task: myinc:count
vars:
PATH: "{{.TASKFILE_DIR}}" ### < This is getting set to the path this task file is in. :)
cmds:
- |
echo "pass path"
path:
desc: Show Count
deps:
- task: myinc:count
cmds:
- |
echo "count on impot vars"
when running path: It echos the directory of the included task file. It's expected to echo the caller Taskfile dir.
when running pathvars: the output is as expected, the callers dir is echoed.
When using other vars within includes.vars they get passed appropriately. I have not tested other go templating behaviors within includes.vars
We have many users using this pattern so this change took us by surprise.
The change of behavior seems to have been introduced in 3.35.1
Prior to that the behavior of setting it within includes..vars worked, but setting it in the task deps..vars was not correct.
The behavior of TASKFILE_DIR has changed when using assignment in include variables.
Having two task files:
caller/demo/caller_Taskfile.yml
include_Taskfile.yaml
when running
path
: It echos the directory of the included task file. It's expected to echo the caller Taskfile dir.when running
pathvars
: the output is as expected, the callers dir is echoed.When using other vars within includes.vars they get passed appropriately. I have not tested other go templating behaviors within includes.vars
We have many users using this pattern so this change took us by surprise.