Skip to content

Commit 20358af

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 `description` parameter to `create_jira_issue` and use it in the issue payload (previously hardcoded to an empty string). Backward compatible: without the new flags the behavior is unchanged. ### 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 verified the description on the resulting issues. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Cursor
1 parent eb3d853 commit 20358af

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

dev/create_spark_jira.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ 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+
)
4151
parser.add_argument(
4252
"--list-components", action="store_true", help="List available components and exit"
4353
)
@@ -60,9 +70,25 @@ def main():
6070
if not args.parent and not args.type:
6171
parser.error("-t/--type is required when not creating a subtask")
6272

73+
if args.description and args.description_file:
74+
parser.error("--description and --description-file cannot be used together")
75+
76+
description = args.description or ""
77+
if args.description_file:
78+
try:
79+
with open(args.description_file, encoding="utf-8") as f:
80+
description = f.read()
81+
except OSError as e:
82+
parser.error("cannot read --description-file: %s" % e)
83+
6384
asf_jira = get_jira_client()
6485
jira_id = create_jira_issue(
65-
asf_jira, args.title, args.component, parent=args.parent, issue_type=args.type
86+
asf_jira,
87+
args.title,
88+
args.component,
89+
parent=args.parent,
90+
issue_type=args.type,
91+
description=description,
6692
)
6793
print(jira_id)
6894

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)