You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by as...@apache.org on 2023/01/11 14:59:31 UTC

[arrow] branch master updated: GH-33610: [Dev] Do not allow ARROW prefixed tickets to be merged nor used on PR titles (#33611)

This is an automated email from the ASF dual-hosted git repository.

assignuser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 385601da03 GH-33610: [Dev] Do not allow ARROW prefixed tickets to be merged nor used on PR titles (#33611)
385601da03 is described below

commit 385601da03c348eb1b46cbfd695164d13f065e14
Author: Raúl Cumplido <ra...@gmail.com>
AuthorDate: Wed Jan 11 15:59:24 2023 +0100

    GH-33610: [Dev] Do not allow ARROW prefixed tickets to be merged nor used on PR titles (#33611)
    
    Now that all issues from JIRA are migrated to GitHub we should always use the GH corresponding issue on the PR title
    * Closes: #33610
    
    Authored-by: Raúl Cumplido <ra...@gmail.com>
    Signed-off-by: Jacob Wujciak-Jens <ja...@wujciak.de>
---
 .github/pull_request_template.md        |  3 +--
 .github/workflows/dev_pr/helpers.js     |  4 ++--
 .github/workflows/dev_pr/title_check.md |  3 +--
 dev/merge_arrow_pr.py                   | 30 ++++++++++++++++++++++++++++--
 4 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 3ed153d0a2..f136f8fd49 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -20,9 +20,8 @@ or
 
     MINOR: [${COMPONENT}] ${SUMMARY}
 
-In the case of old issues on JIRA the title also supports:
+In the case of PARQUET issues on JIRA the title also supports:
 
-    ARROW-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
     PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
 
 -->
diff --git a/.github/workflows/dev_pr/helpers.js b/.github/workflows/dev_pr/helpers.js
index 282567f956..634a0cbce8 100644
--- a/.github/workflows/dev_pr/helpers.js
+++ b/.github/workflows/dev_pr/helpers.js
@@ -26,7 +26,7 @@ const https = require('https');
  * @typedef {Object} Issue
  * @property {string} kind - The kind of issue: minor, jira or github
  * @property {string} id   - The id of the issue:
- *                            ARROW-XXXX, PARQUET-XXXX for jira
+ *                            PARQUET-XXXX for jira
  *                            The numeric issue id for github
  */
 function detectIssue(title) {
@@ -36,7 +36,7 @@ function detectIssue(title) {
     if (title.startsWith("MINOR: ")) {
         return {"kind": "minor"};
     }
-    const matched_jira = /^(WIP:?\s*)?((ARROW|PARQUET)-\d+)/.exec(title);
+    const matched_jira = /^(WIP:?\s*)?((PARQUET)-\d+)/.exec(title);
     if (matched_jira) {
         return {"kind": "jira", "id": matched_jira[2]};
     }
diff --git a/.github/workflows/dev_pr/title_check.md b/.github/workflows/dev_pr/title_check.md
index 589a73aaa8..479a1f76c7 100644
--- a/.github/workflows/dev_pr/title_check.md
+++ b/.github/workflows/dev_pr/title_check.md
@@ -31,9 +31,8 @@ or
 
     MINOR: [${COMPONENT}] ${SUMMARY}
 
-In the case of old issues on JIRA the title also supports:
+In the case of PARQUET issues on JIRA the title also supports:
 
-    ARROW-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
     PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
 
 See also:
diff --git a/dev/merge_arrow_pr.py b/dev/merge_arrow_pr.py
index 6824f6f436..068dfb204e 100755
--- a/dev/merge_arrow_pr.py
+++ b/dev/merge_arrow_pr.py
@@ -120,6 +120,11 @@ def fix_version_from_branch(branch, versions):
         return [v for v in versions if v.startswith(branch_ver)][-1]
 
 
+MIGRATION_COMMENT_REGEX = re.compile(
+    r"This issue has been migrated to \[issue #(?P<issue_id>(\d+))"
+)
+
+
 class JiraIssue(object):
 
     def __init__(self, jira_con, jira_id, project, cmd):
@@ -194,6 +199,17 @@ class JiraIssue(object):
                                   fields.summary, fields.assignee,
                                   fields.components))
 
+    def github_issue_id(self):
+        try:
+            last_jira_comment = self.issue.fields.comment.comments[-1].body
+        except Exception:
+            # If no comment found or other issues ignore
+            return None
+        matches = MIGRATION_COMMENT_REGEX.search(last_jira_comment)
+        if matches:
+            values = matches.groupdict()
+            return "GH-" + values['issue_id']
+
 
 class GitHubIssue(object):
 
@@ -441,12 +457,13 @@ class CommandInput(object):
 
 class PullRequest(object):
     GITHUB_PR_TITLE_PATTERN = re.compile(r'^GH-([0-9]+)\b.*$')
-    # We can merge both ARROW and PARQUET patches
-    JIRA_SUPPORTED_PROJECTS = ['ARROW', 'PARQUET']
+    # We can merge PARQUET patches from JIRA or GH prefixed issues
+    JIRA_SUPPORTED_PROJECTS = ['PARQUET']
     JIRA_PR_TITLE_REGEXEN = [
         (project, re.compile(r'^(' + project + r'-[0-9]+)\b.*$'))
         for project in JIRA_SUPPORTED_PROJECTS
     ]
+    JIRA_UNSUPPORTED_ARROW = re.compile(r'^(ARROW-[0-9]+)\b.*$')
 
     def __init__(self, cmd, github_api, git_remote, jira_con, number):
         self.cmd = cmd
@@ -500,6 +517,15 @@ class PullRequest(object):
             github_id = m.group(1)
             return GitHubIssue(self._github_api, github_id, self.cmd)
 
+        m = self.JIRA_UNSUPPORTED_ARROW.search(self.title)
+        if m:
+            old_jira_id = m.group(1)
+            jira_issue = JiraIssue(self.con, old_jira_id, 'ARROW', self.cmd)
+            self.cmd.fail("PR titles with ARROW- prefixed tickets on JIRA "
+                          "are unsupported, update the PR title from "
+                          f"{old_jira_id}. Possible GitHub id could be: "
+                          f"{jira_issue.github_issue_id()}")
+
         for project, regex in self.JIRA_PR_TITLE_REGEXEN:
             m = regex.search(self.title)
             if m: