kodiak icon indicating copy to clipboard operation
kodiak copied to clipboard

support merge train

Open yanns opened this issue 4 years ago • 8 comments

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/

yanns avatar Jun 02 '20 08:06 yanns

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.

chdsbd avatar Jun 02 '20 16:06 chdsbd

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.

chdsbd avatar Jun 03 '20 00:06 chdsbd

Thx for positive feedback! ❤️ Yes I can guess this feature would change quite a lot and would take some time.

yanns avatar Jun 03 '20 05:06 yanns

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)

jukben avatar Nov 10 '21 08:11 jukben

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.

chdsbd avatar Nov 10 '21 21:11 chdsbd

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 avatar Nov 19 '21 22:11 chdsbd

@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).

jukben avatar Nov 22 '21 09:11 jukben

@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?

jukben avatar Dec 01 '21 14:12 jukben