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

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

How to reference account variables from deployment variables?

Is it possible to reference account variables from deployment variables?

The use case is the following:

- I have multiple repositories which uses the same set of secrets for each Dev, Staging and Production environments. (so 1 set per env)

- Instead of specifieng these in each repository again (duplication), I add the generic Dev, Staging and Prod keys to Account Variables.

- I would like to do the following in 'Deploymenent Variables': GOOGLE_SECRET = $GOOGLE_SECRET_DEV (if deployment stage is 'DEV') or GOOGLE_SECRET = $GOOGLE_SECRET_STG (if deployment stage is 'Staging'). - Where GOOGLE_SECRET_DEV is specified as Account variable.

This way I, able to reuse 'steps' more easyly because I can now use the generic GOOGLE_SECRET, instead of defining different steps for each env.

1 answer

I'm not aware about a generic variable reference feature inside Atlassian Bitbucket Cloud Pipelines plugin specifically.

However as far as a POSIX compatible shell is at your option (e.g. a pipeline step script), the shell has it covered:



If you follow a specific naming convention, the BITBUCKET_DEPLOYMENT_ENVIRONMENT variable might be of use to make this kind of mapping even more implicit. It has the name of the deployment environment as configured. So you can have "preconfigured" environments from the account variables.

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

3,939 views 68 21
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