Add reviewers automatically based on MAINTAINERS data

Bug #1497655 reported by Mike Scherbakov on 2015-09-20
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
High
Alexander Charykov

Bug Description

We need a script which will, on every patch uploaded to Gerrit, add reviewers automatically based on data in MAINTAINERS file(s).

Please see following two patches with introduction of MAINTAINERS files, and follow links provided in commit messages for further details.
https://review.openstack.org/#/c/225457/1 - top-level repo file
https://review.openstack.org/#/c/225458/1 - fuelmenu subfolder

Example:
commit is made to fuel-web/fuelmenu/fuelmenu/modules/interfaces.py, and fuel-web/fuelmenu/fuelmenu/common/errors.py.
Script has to search for MAINTAINERS file in all folders, starting from the folder where files were changed.

The logic should be the following:
- if there is a MAINTAINERS file in fuel-web/fuelmenu/fuelmenu/modules/, add reviewers from 'maintainers' section of the file to the review. Same for another file.
- if there is no MAINTAINERS file fuel-web/fuelmenu/fuelmenu/modules/, go level up and check there.
- continue going up if needed. Do nothing, if file not found or there is no 'maintainers' section in the file.

Two notes:
- there are can be MAINTAINERS files on a few levels of hierarchy. We need to take maintainers only from one file, which is found first (do not collect all). We want only specific subject matters to be added if those defined, not core reviewers / maintainers of the whole module
- if several files are touched by commit, ensure to check MAINTAINERS file for each separately (don't stop on first file). We want to find all subject matter experts.

Igor Shishkin (teran) on 2015-09-20
tags: added: tools
Andrey Nikitin (heos) on 2015-09-22
Changed in fuel:
status: New → Triaged
Changed in fuel:
assignee: Fuel DevOps (fuel-devops) → Alexander Charykov (acharykov)
status: Triaged → In Progress
Alexander Charykov (acharykov) wrote :

MAINTAINERS in different reviews has different format.

I think that MAINTAINERS on top level will have list with dict of repo:

On top level:
{ 'maintainers':
[{'fuelmenu/':
  [{'IRC': 'mattymo',
    'email': '<email address hidden>',
    'name': 'Matthew Mosesohn'},
{'IRC': 'mattymo',
    'email': '<email address hidden>',
    'name': 'Matthew Mosesohn'}],
},
{'docs/':
  [{'IRC': 'mattymo',
    'email': '<email address hidden>',
    'name': 'Matthew Mosesohn'},
{ 'email': '<email address hidden>',
    'name': 'User2'}],
}]}

In subfolders:
{'maintainers': [{
  'IRC': 'mattymo',
  'email': '<email address hidden>',
  'name': 'Matthew Mosesohn'
},
{
  'email': '<email address hidden>',
  'name': 'User2'
}]}

Fix proposed to branch: master
Change author: Alexander Charykov <email address hidden>
Review: https://review.fuel-infra.org/12228

Mike Scherbakov (mihgen) wrote :

There were two possible ways discussed: 1 file which enlist all subfolders in it, or many files.
Looks like people want one file over many.

So let's use https://review.openstack.org/#/c/225457/ as a base then for the script.

Alexander Charykov (acharykov) wrote :

I've made support for both formats - file in dirs and one file in root dir. They work at once and add from both files.

Changed in fuel:
status: In Progress → Confirmed
assignee: Alexander Charykov (acharykov) → Fuel DevOps (fuel-devops)
Artem Silenkov (asilenkov) wrote :

Please this ability to review.fuel-infra.org too. This is extremely useful.

Artem Silenkov (asilenkov) wrote :

*add this ability, sorry for typo.

Dmitry Pyzhov (dpyzhov) on 2015-10-22
tags: added: area-devops
Igor Shishkin (teran) on 2015-11-10
Changed in fuel:
assignee: Fuel DevOps (fuel-devops) → Alexander Charykov (acharykov)
tags: added: area-apps
removed: area-devops tools
tags: added: area-infra-apps
removed: area-apps
Alexander Charykov (acharykov) wrote :

Script for importing is ready, we were trying to create it as gerrit hook on review.openstack.org, but without any success. At the moment there is a jenkins job which is listening comments and trigger on success pass.

Alexander Charykov (acharykov) wrote :

Deployed on ci.fuel-infra.org in testing mode.
https://ci.fuel-infra.org/job/auto-add-reviewers/

Currently script can't authorize on review.opentstack.org, proble is under research.

Changed in fuel:
status: Confirmed → In Progress
Alexander Charykov (acharykov) wrote :

Fix configuration for gerrit user. Script enabled for fuel-main repo now. It will add reviewers on 'Verified+1' comment.

Alexander Charykov (acharykov) wrote :

At the moment script enabled for fuel-main. It has failed few times because job was missing label.
Today or tomorrow I hope it will be enabled for all fuel* repos.

Alexander Charykov (acharykov) wrote :

Awaiting confirmation from CI team to deploy on ci.fuel-infra.org

Alexander Charykov (acharykov) wrote :

Doesn't work with trigger on comment. Research in progress.

Alexander Charykov (acharykov) wrote :

Made some small optimizations for the script. Now waiting for CI team to get it merged and deployed.

Reviewed: https://review.fuel-infra.org/12228
Submitter: Aleksandra Fedorova <email address hidden>
Branch: master

Commit: 6e19e0ca9892339d9997b2700165342b9ba39221
Author: Alexander Charykov <email address hidden>
Date: Tue Dec 29 09:38:06 2015

Job to add people from MAINTAINERS file as reviewers

Change-Id: I97094b317aa79f7341a37c3eb2c85b4e09890afe
Closes-Bug: #1497655

Changed in fuel:
status: In Progress → Fix Committed
Alexander Charykov (acharykov) wrote :
Changed in fuel:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers