Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 do I run multiple deployments against one repository in Bitbucket Pipelines?

I have a pipeline file that uses variables for a simple deployment process. Although in my repository I would like to deploy multiple applications.

I basically would like to have multiple deployments. Where they pass in different variables, for example, lets sat I'm doing a simple thing such as a docker build and a kubernetes deployment:

docker build -t ${IMAGE_NAME} -f ${APPLICATION_NAME}/Dockerfile .

docker push ${IMAGE_NAME}

kubectl set image deployment/${CONTAINER_NAME} ${CONTAINER_NAME}=${IMAGE_NAME}

I have multiple Dockerfiles in my repository, they lie under their specific application folders. So when I push to develop, I wish for them all to be deployed. 

It doesn't appear that this is achievable with ease, so I was wondering if there was a way to do this, I imagine I'm not the first person to ask. So can I either loop through specific steps or have a way of calling my pipeline more than once with different variables? I hope I don't have to replicate the process in multiple steps for each application, the scenario I have is a lot more complex than this and that would take up a lot of space, let alone not fit under the step limit count.

What's the best way to achieve this? I've used Octopus with Team City in the past and it has supposed this with relative ease.

Thanks in advance for your help :-)

1 answer

0 votes

Hi Lloyd,

Would it be possible for you to place these commands inside of a bash script file? And then call the script with the values you need?

For example:


set +e
set +x


docker build -t ${IMAGE_NAME} -f ${APPLICATION_NAME}/Dockerfile .
docker push ${IMAGE_NAME}
kubectl set image deployment/${CONTAINER_NAME} ${CONTAINER_NAME}=${IMAGE_NAME}


- step:
name: Deploy to production
deployment: production
- bash app-name-1 container-name-1 image-name-1
- bash app-name-2 container-name-2 image-name-2
- bash app-name-3 container-name-3 image-name-3

Given that the deployments appear to all be to the same Kubernetes cluster, it makes more sense to have these all in a single step. If you need to deploy to different clusters, then that would be when I recommend you should split this across several steps. 

This might not be an appropriate solution since, as you mentioned, you simplified your use-case. So let me know if this doesn't scale to your use-case, and provide me with some additional details.



This isn't a great solution if you want to deploy to app-name-1 but not app-name-2? Any way that we're able to get an indication for this ability? 


Or would you expect that we split these out into their own pipelines?

An example would be to allow each developer we have to push to their own environment without affecting any other pipeline.

Suggest an answer

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

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

777 views 15 10
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