Hi Team,
We are connecting to a database and making deployments to it from bitbucket pipelines and we have plenty of pipelines in place among which some are scheduled.
We have branch pipelines for many branches where one of the steps in each branch is common. So, we declared a shareable step and calling it in each branch pipeline.
We are making use of Bitbucket self-hosted runners. Earlier, we had a single self-hosted runner because of which only one pipeline used to run at a time.
Later point of time, we added multiple self-hosted runners for making the pipelines fast. But we observed that, two pipelines of the same branch (one is scheduled and other is manual) started running at the same time because of available runners which is resulting in two processes accessing the same object in Database and thereby getting deadlock errors.
To prevent two pipelines in the same branch running at the same time, we thought of separating runners for each branch using Labels for runners and runners section in bitbucket pipeline. So that only one pipeline in a branch would be active at a time, and other pipeline in that branch would get into queuing state.
I tried to parameterize runners section in Bitbucket pipeline in the shareable step to see if the pipeline can pick runners at run time which isn't working.
Could you let me know if there is any chance to parameterize runners in shareable step and to decide the runner at pipeline runtime depending upon the branch?
Please help me with this. Thanks in advance.
Thanks,
Satya.