- Task version: 3.6.0
- Operating System: OpenSUSE Tumbleweed
I believe this is a bug as it is not expected behavior from a user's point of view. Variables that use the shell function, e.g. sh: foo, run before the dependencies in a task. This is, in my opinion, not the expected behavior for the user and is undesirable for most use cases, as it prevents information from being passed from the depended task to the dependent task.
I am trying to pass information from a dependency to a task. I need the dependency to generate a container image ID then use that image ID for subsequent tasks. It should be noted that not all tasks in this Taskfile create a container image, so this is not something that I would prefer to do globally.
If there is a better way to solve this problem please let me know.
Example Taskfile showing the issue
version: '3'
tasks:
generate-bar:
cmds:
- echo foo > bar
generates:
- bar
default:
deps: [generate-bar]
vars:
BAZ:
sh: cat bar
cmds:
- echo {{.BAZ}}
Output
> task
cat: bar: No such file or directory
task: Command "cat bar" failed: exit status 1
I believe this is a bug as it is not expected behavior from a user's point of view. Variables that use the shell function, e.g.
sh: foo, run before the dependencies in a task. This is, in my opinion, not the expected behavior for the user and is undesirable for most use cases, as it prevents information from being passed from the depended task to the dependent task.I am trying to pass information from a dependency to a task. I need the dependency to generate a container image ID then use that image ID for subsequent tasks. It should be noted that not all tasks in this Taskfile create a container image, so this is not something that I would prefer to do globally.
If there is a better way to solve this problem please let me know.
Example Taskfile showing the issue
Output