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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 .
Kind regards,
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.