How to set the output of other tasks to env #708
-
Is there a way to use the stdout of a task as an argument for another task?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
There's currently no built in way besides The problem with tracking the output of an entire Is there more information you can provide as to why writing a script in |
Beta Was this translation helpful? Give feedback.
-
Hi. Thanks again for Taskfile -- amazing software and I now use it in all my projects. I am in a similar situation where using lazy evaluation of variables can significantly improve performance. Consider the Taskfile below: version: '3'
vars:
HOST: '{{.HOST | default "test-ec2-vm"}}'
ID:
sh: >
aws ec2 describe-instances --filters "Name=tag:Name,Values={{.HOST}}"
--query "Reservations[*].Instances[*].InstanceId"
--output text --no-cli-page
IP:
sh: >
aws ec2 describe-instances --filters "Name=tag:Name,Values={{.HOST}}"
--query "Reservations[*].Instances[*].PublicIpAddress"
--output text --no-cli-page
tasks:
start: aws ec2 start-instances --instance-ids --no-cli-page {{.ID}}
stop: aws ec2 stop-instances --instance-ids --no-cli-page {{.ID}}
demo: echo "Testing mic" The Is there any progress on the lazy evaluation of variables? I see a PR #1231 opened, but there's been no update since June. |
Beta Was this translation helpful? Give feedback.
There's currently no built in way besides
sh
in vars to pass data around.The problem with tracking the output of an entire
task
as you are requesting, is that there is a lot of ambiguity in terms of whether or not the output of that tasks dependencies should be included, how output should be concatenated when a task has multiple commands incmds
and what happens if that task is "up-to-date".Is there more information you can provide as to why writing a script in
sh
of a var is not optimal for you?