Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Build for different env using deployment variables

My build step includes different ENV variables for different environments. I can setup different variables using "deployment variables" but I am not able use them during build step. If I use repo variables I can not build for different env. Is there a way to specify different set of variables for builds? Thanks. 

1 answer

1 accepted

1 vote
Answer accepted

Hello rhegde,

you can access deployment variables in the same way you access other variables, with a dollar sign in front. However, deployment variables are only available if that step also has a deployment configured. Here is a sample pipeline that uses a deployment variable:

 

pipelines:
branches:
master:
- step:
deployment: test
script:
- echo $MY_VARIABLE

 

And then configure the deployment variable like this in the deployments settings:

Screen Shot 2020-01-23 at 1.42.03 pm.png

For the purpose of this test make sure it is unsecured. Secured variables can not be echoed in the build logs, you should use that feature for access credentials and other secret information.

 

Ok got it, I just have to add "deployment: name" to that step where I want to use the variables.

On the same not, is it possible to use the deployment variables outside the yaml file just like the repo variable? e.g. in .env files.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,149 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you