-
-
Notifications
You must be signed in to change notification settings - Fork 774
Closed
Description
When I include a Taskfile that has env and vars that overlap the parent taskfile, the parent file's variables get overwritten at parent tasks' scope.
I am running task with the following files:
Taskfile.yml
version: '3'
includes:
child: ./Taskfile.child.yml
env:
ENV_VAR: root-file
vars:
VAR: root-file
tasks:
default: |
echo ENV_VAR is $ENV_VAR
echo VAR is {{ .VAR }}Taskfile.child.yml
version: '3'
env:
ENV_VAR: child-file
vars:
VAR: child-file
# No tasks needed for this example.Expected output:
ENV_VAR is root-file
VAR is root-file
Actual output:
ENV_VAR is child-file
VAR is child-file
I believe the code responsible is here:
Lines 56 to 57 in 114d5e1
| t1.Vars.Merge(t2.Vars, include) | |
| t1.Env.Merge(t2.Env, include) |
Is this intentional behaviour? I would expect that the parent could provide defaults for the child, or override via include.*.vars, but it is surprising to have the child influence values on the parent.
If this is indeed a bug, I'd be happy to contribute a fix.
- Task version: HEAD@114d5e1
- Operating system: MacOS 14.4.1
- Experiments enabled: None
Metadata
Metadata
Assignees
Labels
No labels