Autodelegation based on more complex rules
Konstantin Ryabitsev
konstantin at linuxfoundation.org
Tue Feb 16 01:30:15 AEDT 2021
On Mon, Feb 15, 2021 at 12:14:47PM +0000, Ali Alnubani wrote:
> Hi all,
>
> There are currently 2 ways in Patchwork to autodelegate patches. Patchwork
> can either parse the hint header (X-Patchwork-Delegate), or it can lookup
> the fnmatch-formatted rules for the project.
>
> Projects using a MAINTAINERS file might want to use the same rules they
> already have there for delegation. These rules can be in the hundreds, and
> they can change very often. Managing these manually in django's admin
> interface can be a bit hard (I have even seen that Django will render them
> extremely slowly, will cause very high CPU usage, and 5xx timeouts when
> loading a project's admin page). Adding these rules can be automated using
> django's management shell, however, there are cases where more complex rules
> might be needed to find the right delegate. An example is projects with a
> hierarchy of trees and maintainers, were patches changing files in more than
> a single sub-tree usually require delegating to the maintainer of a
> higher-level tree. Current rule priorities don't support such a case,
> because we would need to consider all files changed at once, not separately.
>
> Can we implement a hook that would call an external and project-specific
> script in parser.py (specifically in find_delegate_by_filename()) to resolve
> the issues above? The script would be expected to take the filenames as an
> argument, and output a delegates email. This way, any complicated rules
> could be managed by that script. I realize there might be security
> implications to this though. Please let me know what you think.
I suggest that you do this outside of patchwork, using procmail and filtering
hooks to set X-Patchwork-Delegate. This is what we do at kernel.org, though we
don't directly parse the MAINTAINERS file. You can see our scripts here:
https://git.kernel.org/pub/scm/infra/patchwork/procmail.git/tree/
If you end up writing a hook that will set X-Patchwork-Delegate based on what
is in MAINTAINERS, I'm sure we'll be happy to adopt it. :)
-K
More information about the Patchwork
mailing list