Create
cancel
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

Usage of Deployment variables on multiple steps

Hi,

I have broken down my pipeline in multiple steps to speed it up, and I'm using deployment variables to manage secrets:

pipelines:
default:
- step:
name: Step1
deployment: test
script:
- echo $DEPLOYMENT_CREDENTIALS > /tmp/keyfile.json
- parallel:
- step:
  name: Step2
   deployment: test
script:
- echo $DEPLOYMENT_CREDENTIALS > /tmp/keyfile.json
- step:
name: Step3
deployment: test
script:
- echo $DEPLOYMENT_CREDENTIALS > /tmp/keyfile.json

 

It looks like my pipeline it invalid, as it doesn't allow to specify "deployment" multiple times, however if I specify it only once the other steps do not find the variables. 

Is it possible to have multiple steps which make use of deployments ? Otherwise any suggestion on how to implement such scenario?

Cheers

 

Nicola

4 answers

0 votes

Hello Nicola,

Currently, you can only define a particular deployment environment once per pipeline. In the example you have provided, you have used it in three steps. Which is why you're get errors in your pipeline.

You could try one of the following strategies. They have various trade-offs though.

  1. Consolidate the steps into a single one. Though, you'll lose the performance improvements you're trying to add.
  2. Create 3 separate environments, then reference each one once in each step. However, this will need duplicate environment variable configuration across the environments. And will also cause three Test environments to show in the dashboard, for what I assume is a single deployment?
  3. Set the Deployment credential as a repository-level variable. This will make it accessible to any pipeline that runs in the repository. But could have security concerns depending on how much trust other users with write access have.

You might also find these feature request interesting to follow: 

If neither of those cover what you'd like, you can also create a new feature request.

It would be helpful for us if you could add details of your use-case to one of those feature requests.

Thanks,

Phil

I have the same issues here. I have three steps to separate functionality but not be able to define the same deployment. This means that the variables that are need to all steps must either be defined elsewhere (very ugly and approach) or create a huge step (also ugly).

And I would like another problem that appears with this deployment limitation. I was using a python image in one step to achieve certain goals. And on the next step I was using another image. Having to merge the multiple steps to one means that I will have to do with one image for all of my goals in this step.

This should be fixed asap.

Like # people like this

Facing the exact same issue there. 
I've added more verbose env variables such as DEV_VARIABLE_NAME, PROD_VARIABLE_NAME in order to keep my multiple steps process.

Please consider fixing this ASAP :) 


Like # people like this

It would be great to be able to reuse the deployment variables.

Like # people like this

we also facing same issue. we have steps like build docker image and push to ECR different AWS account. and another step we are publishing to the Kubernetes (again on different Kubernetes based on deployment).

Here we are facing the same issue. This will be really nice to have.

Like # people like this

Done. Thank you for pointing me that.

Is there any other way to achieve this?

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 ...

1,886 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