Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to setup a bitbucket pipeline to build code once and manually deploy to multiple environments?

Trying to build a BitBucket pipeline file to only build once and then push that build to different environments manually. but right now as i see it builds in each step and pushes. How do i use the image from the previous step.

pipelines:
  custom:
    buildDeploy:
      - step:
          name: Build Keycloak Docker Image and Upload Dev
          services:
            - docker
          deployment: dev
          script:
            - ls -ahl
            - docker build -t keycloak .
            - pipe: atlassian/aws-ecr-push-image:1.2.0
              variables:
                IMAGE_NAME: keycloak
                TAGS: 'latest'
      - step:
          name: Build Keycloak Docker Image and Upload Demo
          services:
            - docker
          deployment: demo
          trigger: manual
          script:
            - ls -ahl
            - docker build -t keycloak .
            - pipe: atlassian/aws-ecr-push-image:1.2.0
              variables:
                IMAGE_NAME: keycloak
                TAGS: 'latest'
      - step:
          name: Build Keycloak Docker Image and Upload Prod
          services:
            - docker
          deployment: Prod
          trigger: manual
          script:
            - ls -ahl
            - docker build -t keycloak .
            - pipe: atlassian/aws-ecr-push-image:1.2.0
              variables:
                IMAGE_NAME: keycloak
                TAGS: 'latest'
options:
  docker: true

1 answer

How do i use the image from the previous step. [?]

Via the registry.

The underlying problem you most likely run into with the design how you deploy the images is that you make use of the `latest` tag which is prone to side-effects that are that harsh that you can't (with your current setup/design)  deploy the same (container image build) revision first to dev, then test and then prod.

But I might misread your pipeline to some extend, as I can't see how the deployment to different environments there work already. If the image push to aws ecr is the deployment already then I can't see how this are actually different environments (here: dev, test and prod).

Maybe you can add a bit more context if your problem is more with creating the images, more with pushing them or more with deploying them to the different dev, test and prod environments and give a bit more description.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,326 views 0 3
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