Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,078
Community Members
 
Community Events
165
Community Groups

How to access deployment environment variables in more than one step?

Is possible?

2 answers

it seems odd that his limitation exists.

could this be added as a feature?

our use case is to write client secrets from Deployment Variables into a file, and in the next step run a pipe which requires those variables.

otherwise I need to quit using the pipe, and script this all out.

0 votes

Hi @Danilo Gentil Setúbal 

An environment can only be deployed to from one step in the pipeline.

You can define the same variable on different environments however and each step will get the value associated with the environment it deploys to.

You can also define account and repository level variables that are available to every step in the pipeline.

For example if you define:

  • A repository level variable: MY_VAR with value my_repo_var
  • A deployment variable on the Test environment: MY_VAR with value my_test_var
  • A deployment variable on the Production environment: MY_VAR with value my_prod_var

Then this pipeline:

pipelines:
default:
- step:
script:
- echo $MY_VAR
- step:
deployment: test
script:
- echo $MY_VAR
- step:
deployment: production
script:
- echo $MY_VAR
- step:
script:
- echo $MY_VAR

will produce the following output:

my_repo_var

my_test_var

my_prod_var

my_repo_var

Please see the following page in our documentation for more information on variables: https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html

Hi 

I have 20 lambdas to deploy, each gets deployed only when there is a change in corresponding code( I am using condition, changesets-include paths to build the corresponding lambda). My concerns is can I specify "deployment: Dev" as 20 times, I mean each step?. Please suggest 

Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,237 views 2 9
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