From 1550f92086f15ff49ddac0a4f36b70dc445aeed2 Mon Sep 17 00:00:00 2001 From: Kent Yao Date: Thu, 24 Aug 2023 11:54:52 +0800 Subject: [PATCH] [CELEBORN-907][INFRA] The Jira Python misses our assignee when it searches users again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … ### What changes were proposed in this pull request? detailed desc can be found https://github.com/apache/spark/commit/8fb799d47bbd5d5ce9db35283d08ab1a31dc37b9 ### Why are the changes needed? bypass upstream bug ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? I guess pan3793 has already hit the issue when resolving CELEBORN-903 at jira side Closes #1832 from yaooqinn/CELEBORN-907. Authored-by: Kent Yao Signed-off-by: zky.zhoukeyong --- dev/merge_pr.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dev/merge_pr.py b/dev/merge_pr.py index f1ba4c6f701..4af319023d4 100755 --- a/dev/merge_pr.py +++ b/dev/merge_pr.py @@ -385,7 +385,7 @@ def choose_jira_assignee(issue, asf_jira): except BaseException: # assume it's a user id, and try to assign (might fail, we just prompt again) assignee = asf_jira.user(raw_assignee) - asf_jira.assign_issue(issue.key, assignee.name) + assign_issue(asf_jira, issue.key, assignee.name) return assignee except KeyboardInterrupt: raise @@ -393,6 +393,19 @@ def choose_jira_assignee(issue, asf_jira): traceback.print_exc() print("Error assigning JIRA, try again (or leave blank and fix manually)") +def assign_issue(client, issue: int, assignee: str) -> bool: + """ + Assign an issue to a user, which is a shorthand for jira.client.JIRA.assign_issue. + The original one has an issue that it will search users again and only choose the assignee + from 20 candidates. If it's unmatched, it picks the head blindly. In our case, the assignee + is already resolved. + """ + url = getattr(client, "_get_latest_url")(f"issue/{issue}/assignee") + payload = {"name": assignee} + getattr(client, "_session").put(url, data=json.dumps(payload)) + return True + + def resolve_jira_issues(title, merge_branches, comment): jira_ids = re.findall("CELEBORN-[0-9]{3,6}", title)