In Buildkite, do all your exports in the same shell before the pipeline upload command. Anything exported after the upload will not reach the steps that are already defined.

Context: From GitHub issue buildkite/agent#2233. Environment changes made in one command cannot mutate an already-running script step; the env is fixed when the step starts. The answer: export the variable in the same shell before the pipeline upload step, so the uploaded pipeline already carries the value. People expect the agent to pick up late exports the way a local shell would, and it does not.