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

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 Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

141 views 1 12
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