[PATCH v1 0/2] RFC: Script to manage teams on the forge

Richard Earnshaw via Sourceware Forge <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <bmm.hl4di8516m.gcc.gcc.rearnsha.211.1.0@forge-stage.sourceware.org>
Hi gcc-patches mailing list,
Richard Earnshaw via Sourceware Forge <[email protected]> has requested that the following forgejo pull request
be published on the mailing list.

Created on: 2026-08-07 12:23:23+00:00
Latest update: 2026-08-07 12:23:45+00:00
Changes: 3 changed files, 467 additions, 6 deletions
Head revision: rearnsha/gcc ref forge-teams commit 67b15c272b494ebe01c253f765ba2a496157153e
Base revision: gcc/gcc ref trunk commit 44ee83bcf7f1a80d4be275932b771b1f7403863e r17-3098-g44ee83bcf7f1a8
Merge base: 44ee83bcf7f1a80d4be275932b771b1f7403863e
Full diff url: https://forge.sourceware.org/gcc/gcc/pulls/211.diff
Discussion:  https://forge.sourceware.org/gcc/gcc/pulls/211
Requested Reviewers:

This patch is in two parts, but it's the second part that's the real code; the first just adds a few forge-Ids to the Maintainers.yml using a new field for the purposes of testing the script added in patch 2 and updates the maintainer_utils code to permit this new entry.
The second patch adds a utility that will read the MAINTAINERS.yml file and then use the data in it to update the team memberships on the forge.  I expect this to be the primary way of managing these teams going forward; it may even be possible to fully automate this so that the script runs automatically whenever a new version of MAINTAINERS.yml is pushed to trunk.
The script takes two optional flags (in addition to the mandatory path to MAINTAINERS.yml):
 -v - verbose mode; causes information about what the script is doing to be printed on stdout
 -n - dry run mode; performs all actions except the final PUT and DELETE operations on the forge.
With both flags on, and with the (currently incomplete) data in MAINTAINERS.yml from patch 1, the output looks something like:

```
$ ./forge_teams.py  -nv ../MAINTAINERS.yml
Accessing https://forge.sourceware.org/api/v1/ for org gcc.
Requesting https://forge.sourceware.org/api/v1/orgs/gcc/teams?page=1&limit=50
GET https://forge.sourceware.org/api/v1/teams/30/members?page=1&limit=50
GET https://forge.sourceware.org/api/v1/teams/32/members?page=1&limit=50
GET https://forge.sourceware.org/api/v1/teams/18/members?page=1&limit=50
GET https://forge.sourceware.org/api/v1/teams/33/members?page=1&limit=50
GET https://forge.sourceware.org/api/v1/teams/35/members?page=1&limit=50
GET https://forge.sourceware.org/api/v1/teams/34/members?page=1&limit=50
Checking membership of Maintainers
  OK: Claudio Bantaloukas (rdfm)
  OK: Tamar Christina (tnfchris)
  OK: Alex Coplan (acoplan)
  OK: Richard Earnshaw (rearnsha)
  OK: Jose E. Marchesi (jemarch)
  OK: Andrea Pinski (pinskia)
  OK: Kyrylo Tkachov (ktkachov)
  OK: Jonathan Wakely (redi)
  remove: ibuclaw
DELETE https://forge.sourceware.org/api/v1/teams/30/members/ibuclaw
  remove: jakub
DELETE https://forge.sourceware.org/api/v1/teams/30/members/jakub
  remove: jason
DELETE https://forge.sourceware.org/api/v1/teams/30/members/jason
  remove: cohenarthur
DELETE https://forge.sourceware.org/api/v1/teams/30/members/cohenarthur
  remove: dmalcolm
DELETE https://forge.sourceware.org/api/v1/teams/30/members/dmalcolm
  remove: fdumont
DELETE https://forge.sourceware.org/api/v1/teams/30/members/fdumont
  remove: iains
DELETE https://forge.sourceware.org/api/v1/teams/30/members/iains
  remove: jsm28
DELETE https://forge.sourceware.org/api/v1/teams/30/members/jsm28
  remove: RichardBiener
DELETE https://forge.sourceware.org/api/v1/teams/30/members/RichardBiener
  remove: rsandifo
DELETE https://forge.sourceware.org/api/v1/teams/30/members/rsandifo
  remove: tschwinge
DELETE https://forge.sourceware.org/api/v1/teams/30/members/tschwinge
Checking membership of Maintainers.Algol68
  OK: Jose E. Marchesi (jemarch)
Checking membership of Maintainers.AArch64
  OK: Alex Coplan (acoplan)
  OK: Tamar Christina (tnfchris)
  OK: Wilco Dijkstra (Wilco)
  OK: Richard Earnshaw (rearnsha)
  OK: Andrea Pinski (pinskia)
  OK: Kyrylo Tkachov (ktkachov)
Checking membership of Maintainers.Arm
  OK: Richard Earnshaw (rearnsha)
  OK: Christophe Lyon (clyon)
Checking membership of Maintainers.libstdcplusplus
  OK: Jonathan Wakely (redi)
Checking membership of Maintainers.forge
  missing: Claudio Bantaloukas (rdfm)
PUT https://forge.sourceware.org/api/v1/teams/35/members/rdfm
Existing managed teams and members:
Maintainers
  ibuclaw
  jakub
  jason
  jemarch
  acoplan
  cohenarthur
  rdfm
  dmalcolm
  pinskia
  fdumont
  iains
  redi
  jsm28
  ktkachov
  RichardBiener
  rearnsha
  rsandifo
  tnfchris
  tschwinge
Maintainers.AArch64
  acoplan
  pinskia
  ktkachov
  rearnsha
  tnfchris
  Wilco
Maintainers.Algol68
  jemarch
Maintainers.Arm
  clyon
  rearnsha
Maintainers.forge
Maintainers.libstdcplusplus
  redi

Desired teams and members:
Maintainers.Global
  rearnsha
  pinskia
Maintainers
  rdfm
  tnfchris
  acoplan
  rearnsha
  jemarch
  pinskia
  ktkachov
  redi
Reviewers
  acoplan
  Wilco
  clyon
  pinskia
Write.After.Approval
  rdfm
  tnfchris
  acoplan
  Wilco
  rearnsha
  clyon
  jemarch
  ktkachov
  redi
Maintainers.Algol68
  jemarch
Maintainers.AArch64
  acoplan
  tnfchris
  Wilco
  rearnsha
  pinskia
  ktkachov
Maintainers.Arm
  rearnsha
  clyon
Maintainers.libstdcplusplus
  redi
Maintainers.forge
  rdfm
```


Obviously, before running this for real I intend to fill in the missing id's so that we don't end up deleting members for real (unless they really are in the wrong teams).

The script does not create a team if it is missing, nor does it remove a team if it is not mentioned; this is deliberate - creating a team involves setting the team permissions and adding the appropriate repositories to that team and while most MAINTAINER.* subteams do not gain any more privileges by being added to a team (the Write.After.Approval team is the primary team for granting access rights) it's possible that there might be exceptions that would need to be handled manually and I'd prefer not to hard-code that right now.  Similarly the script will not remove empty or unlisted teams; though it will mention this during the run if it finds one.

Note that the script can only be usefully run by developers on the forge who have 'owner' privileges on the forge - the full list of teams and their members is not generally available to normal users.


Changed files:
- A: contrib/forge_teams.py
- M: MAINTAINERS.yml
- M: contrib/maintainer_utils.py


Richard Earnshaw (2):
  forge: Initial data for forge notifications
  forge: add a script to manage teams on the forge

 MAINTAINERS.yml             |  43 +++-
 contrib/forge_teams.py      | 417 ++++++++++++++++++++++++++++++++++++
 contrib/maintainer_utils.py |  13 ++
 3 files changed, 467 insertions(+), 6 deletions(-)
 create mode 100755 contrib/forge_teams.py

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.