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

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new ff8c7d800 ORC-2107: Improve `create_orc_jira.py` to support types and 
parents
ff8c7d800 is described below

commit ff8c7d8004c438c3dd7555f46f93130c3ffe0893
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Mon Feb 23 11:24:22 2026 -0800

    ORC-2107: Improve `create_orc_jira.py` to support types and parents
    
    ### What changes were proposed in this pull request?
    
    This PR aims to improve `create_orc_jira.py` to support types and parents.
    
    ### Why are the changes needed?
    
    To make the JIRA issue creation easier.
    
    ### How was this patch tested?
    
    Manual test.
    
    ```
    $ dev/create_orc_jira.py 'Improve `create_orc_jira.py` to support types and 
parents'
    Creating JIRA issue with title: Improve `create_orc_jira.py` to support 
types and parents
    Created JIRA issue: ORC-2107
    git checkout -b ORC-2107
    Switched to a new branch 'ORC-2107'
    Created and checked out branch: ORC-2107
    ['git', 'commit', '-a', '-m', 'ORC-2107: Improve `create_orc_jira.py` to 
support types and parents']
    Created a commit with message: ORC-2107: Improve `create_orc_jira.py` to 
support types and parents
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: `Gemini 3.1 Pro (High)` on `Antigravity`
    
    Closes #2551 from dongjoon-hyun/ORC-2107.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 dev/create_orc_jira.py | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/dev/create_orc_jira.py b/dev/create_orc_jira.py
index 68a89af43..f4c586d19 100755
--- a/dev/create_orc_jira.py
+++ b/dev/create_orc_jira.py
@@ -18,6 +18,7 @@
 #
 
 import os
+import re
 import subprocess
 import sys
 import traceback
@@ -47,19 +48,35 @@ def run_cmd(cmd):
         return subprocess.check_output(cmd.split(" ")).decode("utf-8")
 
 
-def create_jira_issue(title):
+import argparse
+
+def create_jira_issue(title, parent_jira_id=None, issue_type=None):
     asf_jira = jira.client.JIRA(
         {"server": JIRA_API_BASE},
         token_auth=JIRA_ACCESS_TOKEN
     )
 
+    versions = asf_jira.project_versions("ORC")
+    # Consider only x.y.z, unreleased, unarchived versions
+    versions = [
+        x for x in versions
+        if not x.raw["released"] and not x.raw["archived"] and 
re.match(r"\d+\.\d+\.\d+", x.name)
+    ]
+    versions = sorted(versions, key=lambda x: x.name, reverse=True)
+
     issue_dict = {
         'project': {'key': 'ORC'},
         'summary': title,
         'description': '',
-        'issuetype': {'name': 'Improvement'},
+        'versions': [{'name': versions[0].name}],
     }
 
+    if parent_jira_id:
+        issue_dict['issuetype'] = {'name': 'Sub-task'}
+        issue_dict['parent'] = {'key': parent_jira_id}
+    else:
+        issue_dict['issuetype'] = {'name': issue_type if issue_type else 
'Improvement'}
+
     try:
         new_issue = asf_jira.create_issue(fields=issue_dict)
         return new_issue.key
@@ -90,18 +107,23 @@ def main():
     if not JIRA_ACCESS_TOKEN:
         fail("The env-var JIRA_ACCESS_TOKEN is not set.")
 
-    if len(sys.argv) < 2:
-        fail("Usage: %s <JIRA title>" % sys.argv[0])
+    parser = argparse.ArgumentParser(description="Create an ORC JIRA issue.")
+    parser.add_argument("title", help="Title of the JIRA issue")
+    parser.add_argument("-p", "--parent", help="Parent JIRA ID for subtasks")
+    parser.add_argument("-t", "--type", help="Issue type to create when no 
parent is specified (e.g. Bug). Defaults to Improvement.")
+    args = parser.parse_args()
 
-    title = sys.argv[1]
-    print("Creating JIRA issue with title: %s" % title)
+    if args.parent:
+        print("Creating a subtask of %s with title: %s" % (args.parent, 
args.title))
+    else:
+        print("Creating JIRA issue with title: %s" % args.title)
 
-    jira_id = create_jira_issue(title)
+    jira_id = create_jira_issue(args.title, args.parent, args.type)
     print("Created JIRA issue: %s" % jira_id)
 
     create_and_checkout_branch(jira_id)
 
-    create_commit(jira_id, title)
+    create_commit(jira_id, args.title)
 
 
 if __name__ == "__main__":

Reply via email to