how to set variable in multiple steps in parallel.
Hi Nawang,
May you please clarify what is meant by setting variables in multiple steps? Do you mean setting a variable in a particular step, then sharing that value with other steps?
Cheers!
- Ben (Bitbucket Cloud Support)
Hello Ben,
basically we want to setup global variable which can be called in different steps as required.
Global
variables:
DEV_ENV: dev_CLUSTER
DEVOPS_ENV: devops_CLUSTER
VERSION: 1
step:
name: DEV
script:
- execute in $DEV_ENV with $VERSION
step:
name: DEVOPS
variables:
VERSION: 2
script:
- execute in $DEVOPS_ENV with $VERSION
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nawang Lama
If you would like a static global environment variable that can be called across any step in the repository - you should configure a repository variable, these can be called as $VARIABLENAME as you have mentioned in your YML configuration:
If you would like an environment variable that can be set to different values throughout the course of your build, you would need to set the variable in the build - then pass it to other steps as an artifact, here is a Stack Overflow article that explains how to achieve this:
Hope this helps.
Cheers!
- Ben (Bitbucket Cloud Support)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ben
Thank you very much for the message. I am using the same method now but will be much better if we can use variables in step it self for readability of the pipelines. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.