How to define global variables for all taskfiles
Hello. Could you please help me. I can't find a way how to define global variables for all Taskfiles.
I have a lot of Taskfiles and want to define some "user-defined" variables that will be applied for all Taskfiles, but can't find a way how to do it.
I tried to create some Taskfile
and include it to all other Taskfiles
but it looks like variables doesn't propagated with this way.
Do we have some other way how to define set of variables in separate file and include them to Taskfile? Or maybe some way how to define global variables?
Thank you for your support!
1 Reply
Let me give you more context:
I have a structure like
And for each
Taskfile.yml
I want to have command
that I want to call in any directory
in cd project-root
I want to have:
- task command
- task stream1:command
- task stream1:component1:command
cd project-root/stream1
:
- task command
- task component1:command
cd project-root/stream1/task1
:
- task command
And task with include
s works great for this structure.
But I want to define some variables that will be available in every Taskfile. It's doesn't matter from what directory I calls task, it should use variables that I defined somewhere in one place. There may be about 10 of these variables and I would not have to copy them to each Taskfile.
May be you can suggest some other options how to resolve my issue 🙂