Azure Yaml Schema Batch Trigger
Asked Answered
Y

2

17

can anyone explain what Batch in Azure YAML Schema Trigger does?

The only explanation on MSFT website is

batch changes if true; start a new build for every push if false (default)

and this isn't really clear to me

You answered 14/4, 2021 at 22:14 Comment(0)
L
31

Batch changes or Batch trigger actually means batching your CI runs.

If you have many team members uploading changes often, you may want to reduce the number of runs you start. 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.

To clarify this example, let us say that a push A to master caused the above pipeline to run. While that pipeline is running, additional pushes B and C occur into the repository. These updates do not start new independent runs immediately. But after the first run is completed, all pushes until that point of time are batched together and a new run is started.

Leucopoiesis answered 2/5, 2021 at 19:35 Comment(3)
so is it just doing Instead of: pipeline run for commit A pipeline run for commit B but just do one pipeline run for A and B combined?You
@Ryguy444222 Yes, if there are any additional pushes while a pipeline is already running, it combines them into one run rather than building every individual commit/push separately.Leucopoiesis
In short: If there is a queue of runs behind a currently running job, then that queue will be "squashed" into a single job, instead of running each job one by one.Madra
S
2

My interpretation of MS documentation is that the batch boolean is meant to address concerns with encountering frequent pushes to the same trigger branch or set of branches (and possibly tags) and works such that if the build pipeline is already running, any additional changes pushed to the listed branches will be batched together and queued behind the current run. This does mean that those subsequent pushes will be part of the same subsequent pipeline run which is a little strange, but given that's how Microsoft intended it to work it should be fine.

Basically, for repos that have a high potential for demanding pipeline runs and multiple overlapping pushes occurring, batching is great.

For reference, here is the documentation link: https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/azure-repos-git?view=azure-devops&tabs=yaml#batching-ci-runs

Sophist answered 20/10, 2021 at 17:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.