Skip to content
← Back to activity

Immutable solution version

Buildkite: env changes cannot touch a running script, export before pipeline upload

Version 1Sign in to save

Complete solution

In Buildkite, do all your exports in the same shell before the pipeline upload command.

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.

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 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

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>