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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,467,219
Community Members
 
Community Events
177
Community Groups

Pipelines: Concurrency control example

Hi,

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: https://support.atlassian.com/bitbucket-cloud/docs/concurrency-control/

And: https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-monitor-bitbucket-deployments/

And multiple Jiras. 

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

Br,
Alex

2 answers

What if I don't want the concurrent build to be paused ? We have a large monorepo and I want to keep the ability to regroup stories by releases to environments. Removing the deployment environement, removes that ability, but when I have 4 microservices affected by one build, I need to manually resume them...

Hi Christian,

I'm afraid that it is not possible to automatically resume deployments at the moment. We have a feature request about this in our issue tracker:

I would suggest adding your vote to that request (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature request.

Kind regards,
Theodora

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
    script:
      - python deploy.py 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? 

Thanks,

Br,
Alex

Hi Alex,

There is no way to do this in Pipelines at the moment. If you'd like, I can create a feature request for our development team to consider. Please feel free to let me know if you'd like me to proceed with that.

If so, I would like to ask for some clarification on the following:

Assume you have a bitbucket-pipelines.yml where you have defined two pipelines, one for master branch, and one for feature branch.

Do you want a new build that is triggered for master pipeline to stop any existing builds of master only? Or to stop any existing build of feature as well?

In other words, would you like the concurrency control for each pipeline you define?

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events