How does batching work?
Batching allows multiple pull requests in the queue to be tested as a single unit. Given the same CI resources, a system with batching enabled can achieve higher throughput while also reducing the net amount of CI time spent per pull request.
By enabling batching, the cost per pull request in the Merge Queue can be reduced by almost 90%. For example, in the table below, you can see how batching affects the amount spent testing pull requests in the queue.
How does a merge queue work?
Instead of merging your pull requests directly through GitHub/GitLab, engineers submit their pull requests to a merge queues service. A pull request can be submitted to the queue before passing CI or code review is complete. Once the pre-requisites for the queue have been met - the pull request will formally enter the queue.
A merge queue will test your pull request against the changes ahead of it in the queue so that the changes are tested against the predicted view of the branch, assuming everything ahead of it merges successfully. This process is called predictive testing and is illustrated in the video below.
When all the required tests are passing, the merge queue with merge the pull request into the protected branch automatically.
If your pull request fails testing - it will either be retested or removed from the queue for further inspection by the author.
Learn more about merge queues here:
https://docs.trunk.io/merge