Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Pipelines: Concurrency control example


I want to implement Concurrency control but I can not find any concrete example on how this is implemented. All the manuals are to generic.

I have looked at:


And multiple Jiras. 

Can you provide any help to clarify on how Concurrency control is implemented?


1 answer

1 vote
Patrik S Atlassian Team Jun 14, 2022

Hello @Alexander Potter ,

Welcome to Atlassian Community!

The way you can control the pipeline concurrency in Bitbucket cloud is by configuring Deployments, so whenever a pipeline step starts a new deployment to a given environment, Bitbucket will first check if there's any other deployment already running to that same environment.

If there's already a deployment in progress, the later pipeline deployment to the same environment will be paused. Once one of the concurrent pipelines is complete, you can manually resume the paused one.

So to set up the concurrency control in your pipeline you would have to configure a deployment environment in your yml for the steps that are sensitive to concurrency by adding the deployment keyword, like the below example :

- step:
    name: Deploy to test
    image: atlassian/default-image:3
    deployment: test
      - python test

In this example, the step is a deployment to the environment test. If at a given moment more than one pipeline is running at the same time and reaches the step above (deploying to the same environment called test), the later pipelines will be paused. When the first one completes, you will be able to manually start the latter.

You can check and change your repository's deployment environments going to :

  • Repository settings.
  • In the Pipelines section, choose Deployments

There you will be allowed to change the environment name, set environment variables, and restrict the ability to deploy.

Also, you can refer to this documentation for more details about setting up deployment environments and configuring your yml file :

Hope that helps! Let me know in case you have any further questions.

Thank you, @Alexander Potter .

Kind regards,

Patrik S

Hi @Patrik S , 

Thanks for the answer, very helpful! 

Though I did not specify it previously, I was looking for a concurrency control that would cancel my current build in case of a new change and run the new build. I can not find any documentation relating to this issue. Is there a way to configure this in the pipelines? 



Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,181 views 2 9
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