Skip to content

Commit c58eae0

Browse files
committed
[SPARK-57862][INFRA] Allow create_spark_jira.py to set the issue description
### What changes were proposed in this pull request? This PR extends `dev/create_spark_jira.py` (and its helper `dev/spark_jira_utils.py`) so the JIRA description can be set at creation time: - Add `-d`/`--description` and `--description-file` options (mutually exclusive) to `create_spark_jira.py`. - Add `-a`/`--affects-version` to override the auto-detected affected version. - Add a `description` parameter to `create_jira_issue` and use it in the issue payload (previously hardcoded to an empty string). ### Why are the changes needed? `create_jira_issue` hardcoded `"description": ""`, so tickets created via the script had no body and the description had to be added manually afterwards. When creating many issues at once (e.g. a batch of sub-tasks under an umbrella), populating the description at creation time is much more efficient. ### Does this PR introduce _any_ user-facing change? No. This is a developer tooling change; without the new flags the behavior is unchanged. ### How was this patch tested? Manually created JIRA sub-tasks with `--description-file` and `--affects-version` and verified the description and version on the resulting issues. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Cursor
1 parent eb3d853 commit c58eae0

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

dev/create_spark_jira.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ def main():
3838
help="Issue type (e.g. Bug, Improvement)",
3939
)
4040
parser.add_argument("-c", "--component", help="Component for the issue")
41+
parser.add_argument(
42+
"-d",
43+
"--description",
44+
help="Description text for the issue.",
45+
)
46+
parser.add_argument(
47+
"--description-file",
48+
help="Path to a file whose contents are used as the issue description "
49+
"(mutually exclusive with --description).",
50+
)
51+
parser.add_argument(
52+
"-a",
53+
"--affects-version",
54+
help="Affected version, e.g. 4.3.0. Defaults to the latest unreleased version.",
55+
)
4156
parser.add_argument(
4257
"--list-components", action="store_true", help="List available components and exit"
4358
)
@@ -60,9 +75,26 @@ def main():
6075
if not args.parent and not args.type:
6176
parser.error("-t/--type is required when not creating a subtask")
6277

78+
if args.description and args.description_file:
79+
parser.error("--description and --description-file cannot be used together")
80+
81+
description = args.description or ""
82+
if args.description_file:
83+
try:
84+
with open(args.description_file, encoding="utf-8") as f:
85+
description = f.read()
86+
except OSError as e:
87+
parser.error("cannot read --description-file: %s" % e)
88+
6389
asf_jira = get_jira_client()
6490
jira_id = create_jira_issue(
65-
asf_jira, args.title, args.component, parent=args.parent, issue_type=args.type
91+
asf_jira,
92+
args.title,
93+
args.component,
94+
parent=args.parent,
95+
issue_type=args.type,
96+
version=args.affects_version,
97+
description=description,
6698
)
6799
print(jira_id)
68100

dev/spark_jira_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,16 @@ def list_components(asf_jira):
7878
print(c.name)
7979

8080

81-
def create_jira_issue(asf_jira, title, component, parent=None, issue_type=None, version=None):
81+
def create_jira_issue(
82+
asf_jira, title, component, parent=None, issue_type=None, version=None, description=""
83+
):
8284
"""Create a JIRA issue and return the issue key (e.g. SPARK-12345)."""
8385
affected_version = version if version else detect_affected_version(asf_jira)
8486

8587
issue_dict = {
8688
"project": {"key": "SPARK"},
8789
"summary": title,
88-
"description": "",
90+
"description": description or "",
8991
"versions": [{"name": affected_version}],
9092
"components": [{"name": component}],
9193
}

0 commit comments

Comments
 (0)