kodiak
kodiak copied to clipboard
support merge train
Initial condition: 3 PRs are waiting to be merged.
Current situation:
- the first PR is updated to master, then we wait for the tests to be green, then the PR is merged into master.
- we do the same for the 2nd PR
- we do the same for the 3rd PR
New situation: a merge train is created containing the 3 PRs (master + PR 1 + PR 2 + PR 3). Then the tests are run. If the tests are green, then the 3 PRs are merged together.
https://about.gitlab.com/blog/2020/01/30/all-aboard-merge-trains/
I think this would be a great feature to have in Kodiak. That GitLab article has some nice information to work off.
I need to do some more thinking about how this feature could be added to Kodiak, but I think it's possible, albeit with some major additions to Kodiak.
I've done some sketching and I think this is a reasonable feature to add. It's different from Kodiak's normal flow because Kodiak would be creating new branches and waiting on those branches instead of PRs.
That said I would expect this feature to take some time to implement, so you might want to pursue other means of improving test speed first. At my work we've used CircleCI's test splitting feature to split our test runs to run in parallel and it works well.
Kodiak's merge queue limits spurious CI jobs, but one way you might be able to improve your merge throughput is to use update.always
to immediately update your branches when they are out of date.
Thx for positive feedback! ❤️ Yes I can guess this feature would change quite a lot and would take some time.
We would love to have it as well at @productboard. We have quite interesting monorepo setup and sometimes queues will be problem for us (lot of contributors, rapid development, heavy pipelines).
I'm also kinda watch closely https://github.blog/changelog/2021-10-27-pull-request-merge-queue-limited-beta/
Happy to discuss it more (on Zoom, or whatever)
I think the basics for this aren't too difficult to implement using the GitLab blog post as an example. But there's an edge case that I'm not sure how to resolve.
For each merge train, we'll need to create a branch with the commits of the train's PRs. Once this branch passes CI, we want to merge it.
I'm not sure how we could merge the branch if we have the "Require a pull request before merging" branch protection rule.
Maybe this new branch protection feature could allow us to bypass that branch protection problem?
https://github.blog/changelog/2021-11-19-allow-bypassing-required-pull-requests/
@chdsbd Good concerns and findings – that sounds promising – Kodiak would have to probably create that train PR on behalf of someone (some bot account, using token I guess – we have such a account in our org already – used in Danger.js automation).
@chdsbd This is an interesting take on what we are discussing. I haven't tried it, but it sounds like something what would help us. https://docs.mergify.com/actions/queue/#speculative-checks Have you seen it? Any opinions on it?