Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to set variable in steps

Nawang Lama January 30, 2024

how to set variable in multiple steps in parallel. 

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2024

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)

 

Nawang Lama February 1, 2024

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


Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 1, 2024

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)

Like Sabine Mayer likes this
Nawang Lama February 1, 2024

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. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events