Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion dev/create_spark_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ def main():
help="Issue type (e.g. Bug, Improvement)",
)
parser.add_argument("-c", "--component", help="Component for the issue")
parser.add_argument(
"-d",
"--description",
help="Description text for the issue.",
)
parser.add_argument(
"--description-file",
help="Path to a file whose contents are used as the issue description "
"(mutually exclusive with --description).",
)
parser.add_argument(
"--list-components", action="store_true", help="List available components and exit"
)
Expand All @@ -60,9 +70,25 @@ def main():
if not args.parent and not args.type:
parser.error("-t/--type is required when not creating a subtask")

if args.description and args.description_file:
parser.error("--description and --description-file cannot be used together")

description = args.description or ""
if args.description_file:
try:
with open(args.description_file, encoding="utf-8") as f:
description = f.read()
except OSError as e:
parser.error("cannot read --description-file: %s" % e)

asf_jira = get_jira_client()
jira_id = create_jira_issue(
asf_jira, args.title, args.component, parent=args.parent, issue_type=args.type
asf_jira,
args.title,
args.component,
parent=args.parent,
issue_type=args.type,
description=description,
)
print(jira_id)

Expand Down
6 changes: 4 additions & 2 deletions dev/spark_jira_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@ def list_components(asf_jira):
print(c.name)


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

issue_dict = {
"project": {"key": "SPARK"},
"summary": title,
"description": "",
"description": description or "",
"versions": [{"name": affected_version}],
"components": [{"name": component}],
}
Expand Down