tektoncd / pipeline

A cloud-native Pipeline resource.
https://tekton.dev
Apache License 2.0
8.37k stars 1.76k forks source link

assigning script stdout to a variable #7320

Open tirelibirefe opened 8 months ago

tirelibirefe commented 8 months ago

Hello, I've searched the documentation but there is no clear sample.

I've seen an use case here here. Also there are some samples how to run scripts but maybe stdout usage in other steps wasn't mentioned intentionally. I am not sure Tekton supports usage of stdout of a step in another step. Maybe it is supported anyway but not documented.

There are many circumstances need to run script but when the stdout cannot be used in other steps, running script is totally useless.

Thanks & Regards

vdemeester commented 8 months ago

Hey @tirelibirefe, I wonder if what you are looking for is the following doc. In the current version, it requires enabling alpha API. It allows you to declare where the output (stdout and/or stderr) will be written in the Task's filesystem to be share with other steps. But in general, today (without alpha enabled), it is possible to do this exactly the way you would do with a shell script, using tee for example (making sure set -o pipefail is set for bash).

my-script-or-command | tree > /workspace/output-for-my-script