I have a BuildKite pipeline with two command steps and a block step in-between. Among other things, the first command step gathers a bunch of information and puts it into environment variables. Then the block runs and asks the user to continue. Assuming approved, the second command runs but does not have the previously-set environment variables (separate step, could be separate agent, etc.).
Simplest reproducible:
steps:
- label: "Test setting variable"
command: |
export MY_VAR=SomeValue
- wait: ~
- label: "Test using variable"
command: |
echo MY_VAR=$$MY_VAR
Is there any way to tell BuildKite to add exported environment variables to the pipeline-wide variables? I have a wait
so the second step will not run until the first finishes.
I realize I can use buildkite-agent meta-data set/get
. I'll do that if there is no better way.
Thank you.