Skip to content

Commit 372a467

Browse files
committed
ORC-2109: Improve create_orc_jira.py to support the version parameter
### What changes were proposed in this pull request? This PR aims to improve `create_orc_jira.py` to support the version parameter. ### Why are the changes needed? To accept `Affected Version` for `Bug` type issues easily. ### How was this patch tested? Manual tests. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: `Gemini 3.1 Pro (High)` on `Antigravity` Closes #2554 from dongjoon-hyun/ORC-2109. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 419de6e commit 372a467

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

dev/create_orc_jira.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,30 @@ def run_cmd(cmd):
5050

5151
import argparse
5252

53-
def create_jira_issue(title, parent_jira_id=None, issue_type=None):
53+
def create_jira_issue(title, parent_jira_id=None, issue_type=None, version=None):
5454
asf_jira = jira.client.JIRA(
5555
{"server": JIRA_API_BASE},
5656
token_auth=JIRA_ACCESS_TOKEN,
5757
timeout=(3.05, 30)
5858
)
5959

60-
versions = asf_jira.project_versions("ORC")
61-
# Consider only x.y.z, unreleased, unarchived versions
62-
versions = [
63-
x for x in versions
64-
if not x.raw["released"] and not x.raw["archived"] and re.match(r"\d+\.\d+\.\d+", x.name)
65-
]
66-
versions = sorted(versions, key=lambda x: x.name, reverse=True)
60+
if version:
61+
affected_version = version
62+
else:
63+
versions = asf_jira.project_versions("ORC")
64+
# Consider only x.y.z, unreleased, unarchived versions
65+
versions = [
66+
x for x in versions
67+
if not x.raw["released"] and not x.raw["archived"] and re.match(r"\d+\.\d+\.\d+", x.name)
68+
]
69+
versions = sorted(versions, key=lambda x: x.name, reverse=True)
70+
affected_version = versions[0].name
6771

6872
issue_dict = {
6973
'project': {'key': 'ORC'},
7074
'summary': title,
7175
'description': '',
72-
'versions': [{'name': versions[0].name}],
76+
'versions': [{'name': affected_version}],
7377
}
7478

7579
if parent_jira_id:
@@ -112,14 +116,15 @@ def main():
112116
parser.add_argument("title", help="Title of the JIRA issue")
113117
parser.add_argument("-p", "--parent", help="Parent JIRA ID for subtasks")
114118
parser.add_argument("-t", "--type", help="Issue type to create when no parent is specified (e.g. Bug). Defaults to Improvement.")
119+
parser.add_argument("-v", "--version", help="Version to use for the issue")
115120
args = parser.parse_args()
116121

117122
if args.parent:
118123
print("Creating a subtask of %s with title: %s" % (args.parent, args.title))
119124
else:
120125
print("Creating JIRA issue with title: %s" % args.title)
121126

122-
jira_id = create_jira_issue(args.title, args.parent, args.type)
127+
jira_id = create_jira_issue(args.title, args.parent, args.type, args.version)
123128
print("Created JIRA issue: %s" % jira_id)
124129

125130
create_and_checkout_branch(jira_id)

0 commit comments

Comments
 (0)