2

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?

MartijnvdB
  • 685
  • 8
  • 21

2 Answers2

1

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.

Alexander Zhukov
  • 4,149
  • 1
  • 18
  • 30
0

as was explained in this link, you can define the Environment Variables and copy them to a file.

After that you can share that file between steps as an Artifact.

Gigi_men
  • 11
  • 1