How to share environment variables in parallel Bitbucket pipeline steps?

MartijnvdB

So, I am using Bitbucket pipelines to deploy my application. The app consists of two components: 1 and 2. They are deployed in two parallel steps in the Bitbucket pipeline:

pipelines:
  custom:
    1-deploy-to-test:
      - parallel:
        - step:
            name: Deploying 1
            image: google/cloud-sdk:latest
            script:
              - SERVICE_ENV=test
              - GCLOUD_PROJECT="some-project"
              - MEMORY_LIMIT="256Mi"
              - ./deploy.sh
        - step:
            name: Deploying 2
            image: google/cloud-sdk:latest
            script:
              - SERVICE_ENV=test
              - GCLOUD_PROJECT="some-project"
              - MEMORY_LIMIT="256Mi"
              - ./deploy2.sh

The environment variables SERVICE_ENV, GCLOUD_PROJECT and MEMORY_LIMIT are always the same for deployments 1 and 2.

Is there any way to define these variables once for both parallel steps?

Alexander Zhukov

You can use User-defined variables in Pipelines. For example, you can configure your SERVICE_ENV, GCLOUD_PROJECT and MEMORY_LIMIT as a Repository variables and they will be available to all steps in your pipeline.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to config Environment for Image bitbucket pipeline

Assigning variables in a parallel step using Declarative Pipeline steps in Jenkins

How to assign environment variables in parallel in bash

Bitbucket Pipelines share SOME steps between branches

How to use environment variables in a powershell pipeline?

How can masked pipeline environment variables be used?

How to set environment variables in a Jenkins Scripted Pipeline?

do bitbucket pipeline steps have to be sequential?

Python how to loop multiple variables and different steps parallel?

parallel steps on different nodes on declarative jenkins pipeline cannot access variables defined in global scope

Bitbucket pipeline - assign custom variables

How can I dump bitbucket environment variables into a file?

Jenkins pipeline: execute steps in parallel dynamically

Dynamic number of parallel steps in declarative pipeline

collect data from Jenkins pipeline parallel steps

Dynamically defining parallel steps in declarative jenkins pipeline

Jenkins declarative pipeline parallel steps executors

Jenkins Pipeline and huge amount of parallel steps

How to declare steps jenkinsfile to inject environment variables by reading a properties file

How to share my environment variables with open source projects?

How can I safely share environment variables with my team

How to dynamically set environment variables in scripted jenkins pipeline?

How to use Environment Variables in CI/CD Pipeline in Azure

Docker compose share environment variables

How to use Prettier on Bitbucket pipeline?

Jenkins Pipeline accessing environment variables

Updating heroku pipeline environment variables

Jenkins environment variables using the pipeline

Azure Pipeline Environment Variables Not Set