-
-
Notifications
You must be signed in to change notification settings - Fork 625
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
Calling parent task with templating bug #1876
Comments
Indeed this syntax is not compatible with templating. As workaround you can do this : # https://taskfile.dev
version: '3'
tasks:
hello:
cmds:
- task: '{{if .CALL_PARENT_TASK}}parent_work{{else}}work{{end}}'
parent_work:
cmds:
- task: :work
work:
cmds:
- echo "hello from child!"
|
@vmaerten Thanks. Yes i am using that workaround in the meantime. |
I'm closing this because it's unlikely we will modify it, and we have a workaround. |
@vmaerten i don't think just closing this is adding any value. I have some questions:
Just because there is a workaround, it does not mean we can sweep the issue under the rug. It will pop up again. |
Use case
A child task (included taskfile task) which can either call its task or a parent task. The behavior is determined based on a variable using template conditional logic.
Example Taskfiles
.
├── child
│ └── Taskfile.yml
└── Taskfile.yml
Child Taskfile
Parent Taskfile
Output
Running the parent Taskfile
task test1
always works as expected:However, running the parent task
task test2
always fails:It seems that the templating has an effect on calling parent tasks.
The text was updated successfully, but these errors were encountered: