From c209241f53f9d20c4934beb7f48fd20c31b8bfb7 Mon Sep 17 00:00:00 2001 From: driazati Date: Wed, 23 Mar 2022 12:39:01 -0700 Subject: [PATCH 1/2] [ci] Roll out teams-tagging to everyone This removes the check for opted-in users from #10317, making it so anyone can attach their names without having to also opt-in. Also included is a script to generate the list of owners from `CONTRIBUTING.md` which was used to update #10317. --- tests/scripts/github_tag_teams.py | 19 --------- tests/scripts/list_topic_owners.py | 62 ++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 19 deletions(-) create mode 100755 tests/scripts/list_topic_owners.py diff --git a/tests/scripts/github_tag_teams.py b/tests/scripts/github_tag_teams.py index a461f562d784..cd32b3c03f99 100755 --- a/tests/scripts/github_tag_teams.py +++ b/tests/scripts/github_tag_teams.py @@ -77,18 +77,6 @@ def fetch_issue(github: GitHubRepo, issue_number: int): return r -def find_rollout_users(r: Dict[str, Any]): - issue = r["data"]["repository"]["issue"] - body = issue["body"] - for line in body.split("\n"): - line = line.strip() - if line.startswith("[temporary] opt-in: "): - line = line[len("[temporary] opt-in: ") :] - return find_ccs("cc " + line) - - return [] - - def parse_teams(r: Dict[str, Any], issue_number: int) -> Dict[str, str]: """ Fetch an issue and parse out series of tagged people from the issue body @@ -209,9 +197,6 @@ def gen_cc_line(users): # Fetch the list of teams teams = parse_teams(issue_data, issue_number=int(args.team_issue)) - # When rolling out this tool it is limited to certain users, so find that list - rollout_users = find_rollout_users(issue_data) - print(f"[slow rollout] Limiting to opted-in users: {rollout_users}") print(f"Found these teams in issue #{args.team_issue}\n{json.dumps(teams, indent=2)}") @@ -236,10 +221,6 @@ def gen_cc_line(users): tags = [t.lower() for t in tags] print(f"Found tags: {tags}") - if author not in rollout_users: - print(f"Author {author} is not opted in, quitting") - exit(0) - # Update the PR or issue based on tags in the title and GitHub tags to_cc = [teams.get(t, []) for t in tags] to_cc = list(set(item for sublist in to_cc for item in sublist)) diff --git a/tests/scripts/list_topic_owners.py b/tests/scripts/list_topic_owners.py new file mode 100755 index 000000000000..d1507b17a49b --- /dev/null +++ b/tests/scripts/list_topic_owners.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import argparse +import re +import json +from collections import defaultdict + +from cmd_utils import REPO_ROOT + +CONTRIBUTORS = REPO_ROOT / "CONTRIBUTORS.md" + + +if __name__ == "__main__": + help = "List out users by team from CONTRIBUTORS.md" + parser = argparse.ArgumentParser(description=help) + parser.add_argument("--format", default="github", help="'github' or 'json' for output") + args = parser.parse_args() + + with open(CONTRIBUTORS) as f: + content = f.readlines() + + parse_line = False + all_topics = defaultdict(lambda: []) + for line in content: + if line.strip().startswith("## Committers"): + parse_line = True + elif line.strip().startswith("##"): + parse_line = False + + if parse_line and line.startswith("- ["): + line = line.strip() + m = re.search("github.com\/(.*?)\).* - (.*)", line) + user = m.groups()[0] + topics = [t.lower().strip() for t in m.groups()[1].split(",")] + for t in topics: + all_topics[t].append(user) + + all_topics = dict(all_topics) + if args.format == "json": + print(json.dumps(all_topics, indent=2)) + else: + items = sorted(all_topics.items(), key=lambda x: x[0]) + for topic, users in items: + users = [f"@{user}" for user in users] + users = " ".join(users) + print(f"- {topic} {users}") From e4778fa4d6d3291cb1eddd5b063e42e176e1e3f9 Mon Sep 17 00:00:00 2001 From: driazati Date: Wed, 23 Mar 2022 15:12:49 -0700 Subject: [PATCH 2/2] Cleanup after discussion --- tests/scripts/list_topic_owners.py | 62 ------------------------------ 1 file changed, 62 deletions(-) delete mode 100755 tests/scripts/list_topic_owners.py diff --git a/tests/scripts/list_topic_owners.py b/tests/scripts/list_topic_owners.py deleted file mode 100755 index d1507b17a49b..000000000000 --- a/tests/scripts/list_topic_owners.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import argparse -import re -import json -from collections import defaultdict - -from cmd_utils import REPO_ROOT - -CONTRIBUTORS = REPO_ROOT / "CONTRIBUTORS.md" - - -if __name__ == "__main__": - help = "List out users by team from CONTRIBUTORS.md" - parser = argparse.ArgumentParser(description=help) - parser.add_argument("--format", default="github", help="'github' or 'json' for output") - args = parser.parse_args() - - with open(CONTRIBUTORS) as f: - content = f.readlines() - - parse_line = False - all_topics = defaultdict(lambda: []) - for line in content: - if line.strip().startswith("## Committers"): - parse_line = True - elif line.strip().startswith("##"): - parse_line = False - - if parse_line and line.startswith("- ["): - line = line.strip() - m = re.search("github.com\/(.*?)\).* - (.*)", line) - user = m.groups()[0] - topics = [t.lower().strip() for t in m.groups()[1].split(",")] - for t in topics: - all_topics[t].append(user) - - all_topics = dict(all_topics) - if args.format == "json": - print(json.dumps(all_topics, indent=2)) - else: - items = sorted(all_topics.items(), key=lambda x: x[0]) - for topic, users in items: - users = [f"@{user}" for user in users] - users = " ".join(users) - print(f"- {topic} {users}")