I use batch: true for Azure DevOps pipeline's trigger:
trigger:
batch: true
branches:
include:
- master
..and it works as expected (next build starts only when previous completed).
By default multiple build are running in parallel:

I tried:
pr:
batch: true
branches:
include:
- master
..but it fails:

How can I do the same for Pull requests?
Batch will only work with CI trigger at the moment.
Pull request (PR) triggers cause a build to run whenever a pull request is opened with one of the specified target branches, or when changes are pushed to such a pull request.
By default, pipelines triggered by pull requests (PRs) will be canceled if a new commit is pushed to the same PR. You can auto cancel an existing pipeline when a pull request is updated.
This is desirable in most cases since usually you don't want to continue running a pipeline on out-of-date code. If you don't want this behavior, you can add autoCancel: false to your PR trigger.
pr:
autoCancel: false
branches:
- master
More details please kindly refer our official doc here: Specify events that trigger pipeline builds and releases
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With