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

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

Danilo Gentil Setúbal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 2, 2019

It's possible?

2 answers

1 vote
Jon Kofal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 26, 2019

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
StannousBaratheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2019

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

koti r December 11, 2021

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 

Like Götz likes this
Todor Tanevski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 3, 2022

@StannousBaratheon so, if we divide our deployment into two steps, one is build the application, and other is deploy, and we want a manual approval/click prior second step; and both use same variables from the same deployment (i.e. development, as distinct from staging and production) - this is not possible, right?

can we use manual approval in the middle of a single step?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events