Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Build after the previous execution has succeeded" in Azure Devops

I have a an Azure Pipeline A, that executes a deployment to my Salesforce org in the event of a PR merge.

My problem statement is,

I am not able to restrict the execution of this pipeline such that it executes only after the previous execution of the same pipeline has completed.

In other words, if this pipeline is triggered by multiple PR's, then I would want only once instance of the pipeline to run. The next one should wait until the previous run has been completed.

Is there a way to achieve this?

like image 926
B.T Anand Avatar asked Oct 20 '25 09:10

B.T Anand


2 Answers

You can enable "Batch changes while a build is in progress" option to execute one pipeline at a time. enter image description here If your question was on Release Pipeline, you can achieve this through specifying number of executions in the "Deployment queue settings" under Pre-Deployment conditions for the particular stage.

enter image description here

like image 176
Fairoz Avatar answered Oct 22 '25 01:10

Fairoz


If you are using YAML you should be able to use the following trigger:

trigger:
  batch: true
  branches:
    include:
      - your-branch

The most relevant part of the documentation:

If you set batch to true, when a pipeline is running, the system waits until the run is completed, then starts another run with all changes that have not yet been built. By default, batch is false. batch is not supported in repository resource triggers.

https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/trigger?view=azure-pipelines#properties

like image 43
cal5barton Avatar answered Oct 21 '25 23:10

cal5barton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!