Skip to content

Draft: Use GitLab API to fetch assigned MRs

Sorry for my long silence, live and work have kept me busy, and admittedly, marge-bot has been running so fine, that it was kept under radar 😄

This MR is how we are running marge-bot in our organization (der-freitag), see below.

It probably breaks quite a lot of tests and assumptions, but if the idea is sound, we could add a flag to turn this mode on.

Operation

We have quite a few repositories (~40), but most of them are not that used, mostly 5 to 10. The default operation mode to go through all repositories to see which ones had MRs assigned to marge-bot was quite slow for our use case, so the code here changes the approach to do an API call to /merge_requests?scope=assigned_to_me&state=opened which returns all MRs assigned to marge-bot, this means zero iteration over all repositories to find which MRs are ready to be picked up 🎉

Then, the usual processing of MRs happens.

Finally, to have less noise, we use a 30 seconds delay whenever marge-bot runs out of MRs to process as to not SPAM GitLab with needless requests.

It would be great to have a wait to get notifications from GitLab rather than marge-bot having to pull every X seconds, this way, we would have a perfect zero noise integration 😄

Moving forward

If the idea of using an API call to get MRs is acceptable, should we make it the default? guard it behind an option? 🤔

The pull/push change to get marge-bot would be quite another big change, I think this would be #389 right?

I'm looking forward to your comments! 🤗

Merge request reports