Why can't I use an environment more then once in my pipeline

Mattijs Spierings October 28, 2020

So I am trying to separate my AWS CDK build and deploy in 2 steps, so that I can rerun one of the steps if necessary:

pipelines:
branches:
master:
- step:
<<: *build
deployment: development
name: Build for development
- step:
<<: *deploy
deployment: development
name: Deploy to development

So the Build step required the deployment variable because it used in AWS CDK code.

And the deploy also needs it to get the right AWS_ACCESS_KEYs .

Bitbucket doesnt allow me to use this variable deployment twice.

How do I resolve this issue?

My current solution is the have build & deploy in one step.

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 2, 2020

Hi Mattijs and welcome to the community.

Apart from having both build and deploy in the one step, you could also:

  • Configure the deployment variables as repository or workspace variables instead. This way, they'll be available to all steps.
  • You could also create two deployment environments and define the same variables in both of them.

We have a feature request for what you are asking in our issue tracker:

I would suggest adding your vote there (by selecting the Vote for this issue link), as the number of votes helps the development team and product managers better understand the demand for new features. You can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates. When there is an update, it will be posted in this public ticket.

Please note though that we don't provide ETAs and implementation of new features is done as per our policy here: https://confluence.atlassian.com/cloud/new-features-744721668.html.

Please feel free to let me know if you have any other questions.

Kind regards,
Theodora

Mattijs Spierings November 4, 2020

Hi,

 

the `deployment` variable can't be a repo variable because it has different meanings for each deployment: DEV | STAGING | PROD.

The build step needs to know what env it is building for, and the deployment to AWS also needs to know to get the correct secret key.

 

Yes, 2 deployment variables with a slight different name could work until there is a better fix.

 

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events