Search code examples
environment-variablesbitbucket-pipelines

Make variable visible across steps in Bitbucket pipelines?


I would like to share a variable across two steps.

I define it like:

- export MY_VAR="FOO-$BITBUCKET_BUILD_NUMBER"

but then when I try to print it in other step:

- echo $MY_VAR

it's empty.

How I can share such variable?


Solution

  • I'm afraid, but it seems impossible to share environment variable from one step to another, BUT you can define global environment variables for all steps in the settings of the project under pipelines category.

    Settings -> Pipelines -> Repository Variables