OCA / oca-github-bot

The GitHub Bot of the Odoo Community Association (OCA)
MIT License
42 stars 61 forks source link

Automatic backward/forward porting? #55

Open yajo opened 5 years ago

yajo commented 5 years ago

This was discussed long ago at https://github.com/OCA/maintainer-tools/issues/381 but it seems that today the part of version bumping is solved by the bot and... well, we have a bot; so it might be a good moment to reopen the discussion.

One of the worst parts about code maintenance here in OCA is the presence of several versions of the same code across different git branches, and I know it won't change, but today we have this bot, which is a good foundation to finally attack this problem without altering current workflow.

Odoo itself uses the same system, but they actually have a combination of bot and humans to perform the merge+forwardport loop sanely, and a different product and policy to offer, which helps their maintenance.

It would be great if the bot could handle forward ports (backward would be awesome too). To avoid the dangers of automatic code ports, all the bot should do is:

  1. Am I instructed to do the forward port? then:
  2. Try to rebase this patch onto the next version branch. Some special machinery will be needed to ignore conflicts in version bumps. Did it rebase? then:
    1. Open a PR to that new version.
    2. Assign it to whoever instructed the bot to forwardport the original PR.
  3. If it didn't rebase, just add a comment there in the original PR specifying the reasons for not forwardporting. Humans will have to handle this case.

The same for backward ports (that could be left for the future).

A cool thing to have in mind would be massive version migrations. This again can be left for the future, but imagine a scenario where Odoo 13.0 is released, then the 13.0 branches are opened, and then the bot does by itself the commit and code forward ports and opens a PR per module.

This would let humans focus in the corner cases, increasing speed of development and reducing repetitive maintenance tasks :muscle:, which often get undone due to their nature. :blush:

pedrobaeza commented 5 years ago

It's a good idea, but the best one is the automatic migration try for all the modules.

For the forward-port/backport, this is now simpler: as the version bumping is now done by the bot, it's way easier to just cherry-pick the PR commit without conflicts and push directly for a qualified maintainer, or create the pull request. Any way, an instruction in the original PR like:

/ocabot cherry-pick branch

is very feasible, that performs:

  1. Create branch starting out of branch.
  2. Cherry-pick the commits of the PR (without extra ones that OCA Bot merger does on another branch)
  3. Create a pull request with this.

And then, the usual review or /ocabot merge instruction process will act.

For the mass migration, it looks like more a tool for maintainer-tools than something for the bot IMO.

yajo commented 5 years ago

So you mean that you'd prefer that the forwardport should be the default behavior instead?

I like it. :sunglasses:

pedrobaeza commented 5 years ago

No, I mean that you instruct the bot to make the forward-port/backport for you.

sbidoul commented 5 years ago

On which repo would we create the source branch for the back/forward port PR?

If we create it on the OCA repo, contributors that are not PSC members will not be able to work on it.

yajo commented 5 years ago

I like the way that Odoo chose. The fw port bot pings reviewers, mergers and contributors from original PR. Then if something goes wrong with the port, he notifies them every now and then. The original contributor can:

  1. Add code suggestions.
  2. Open its own PR superseding the automatic one.
  3. Open a PR against the fwport branch.

Maybe the bot should display instructions on how to do any of those.

I guess it's a matter of time until github allows adding permissions to specific PR branches.

sbidoul commented 4 years ago

I made myself this little tool to facilitate back/forward porting or PRs.

yajo commented 4 years ago

Cool, although this should be a bot job IMHO.