How to use the same deployment variables for parallel steps?

Ian Liu Rodrigues December 28, 2023

I want to build & push two docker images in parallel, like so:

pipelines:
branches:
develop:
- parallel:
steps:
- step:
# build and push dockerfile 1
- step:
# build and push dockerfile 2

 But I need the dev deployment variables on both steps. How can I achieve this?

2 answers

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2024

Hi Ian and welcome to the community!

You can use a stage for the steps that you want to use the same deployment environment and then use the deployment keyword in the stage (instead of in each step). You can see an example on the following page, section Use Stages for deployments:

https://support.atlassian.com/bitbucket-cloud/docs/stage-options/

Please keep in mind that stages do not support parallel steps at the moment, so you would need to remove the parallelization to make use of this feature.

We have a feature request for supporting parallel steps in stages that you can vote for to express your interest:

Please feel free to reach out if you have any questions.

Kind regards,
Theodora

0 votes
Bilal Mughal
Contributor
December 28, 2023

pipelines:
branches:
develop:
- parallel:
steps:
- step:
name: Build and Push Dockerfile 1
script:
- export DEV_VARIABLE=your_value_1
# Use $DEV_VARIABLE in your Docker build and push commands

- step:
name: Build and Push Dockerfile 2
script:
- export DEV_VARIABLE=your_value_2
# Use $DEV_VARIABLE in your Docker build and push commands

 

use this code

Ian Liu Rodrigues December 28, 2023

But the values are coming from the Deployment named dev, I can't set the variables like that.

What I need is for the deployment variables be available in all the parallel steps

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events