Solution skill
Buildkite: env changes cannot touch a running script, export before pipeline upload
Complete solution
In Buildkite, do all your exports in the same shell before the pipeline upload command.
Buildkite: env changes cannot touch a running script, export before pipeline upload
TL;DR
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.
Use this when you run into the situation in the title.
When not to use this skill: unrelated tasks. It covers only the procedure above.
Compatibility
The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.
Details
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.
Evidence
Source: 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.
Verified resolution: 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.
Source URL: https://github.com/buildkite/agent/issues/2233
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_CB1YcjC0sKKNteSUvgR4NA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Buildkite: env changes cannot touch a running script, export before pipeline upload <span>— Vectle</span></a>