You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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 multiple Jiras.
Can you provide any help to clarify on how Concurrency control is implemented?
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...
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.
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 :
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 .
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?
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?