@@ -50,7 +50,7 @@ def run_cmd(cmd):
5050
5151import argparse
5252
53- def create_jira_issue (title , parent_jira_id = None , issue_type = None , version = None ):
53+ def create_jira_issue (title , parent_jira_id = None , issue_type = None , version = None , component = None ):
5454 asf_jira = jira .client .JIRA (
5555 {"server" : JIRA_API_BASE },
5656 token_auth = JIRA_ACCESS_TOKEN ,
@@ -76,6 +76,9 @@ def create_jira_issue(title, parent_jira_id=None, issue_type=None, version=None)
7676 'versions' : [{'name' : affected_version }],
7777 }
7878
79+ if component :
80+ issue_dict ['components' ] = [{'name' : component }]
81+
7982 if parent_jira_id :
8083 issue_dict ['issuetype' ] = {'name' : 'Sub-task' }
8184 issue_dict ['parent' ] = {'key' : parent_jira_id }
@@ -117,14 +120,15 @@ def main():
117120 parser .add_argument ("-p" , "--parent" , help = "Parent JIRA ID for subtasks" )
118121 parser .add_argument ("-t" , "--type" , help = "Issue type to create when no parent is specified (e.g. Bug). Defaults to Improvement." )
119122 parser .add_argument ("-v" , "--version" , help = "Version to use for the issue" )
123+ parser .add_argument ("-c" , "--component" , help = "Component for the issue" )
120124 args = parser .parse_args ()
121125
122126 if args .parent :
123127 print ("Creating a subtask of %s with title: %s" % (args .parent , args .title ))
124128 else :
125129 print ("Creating JIRA issue with title: %s" % args .title )
126130
127- jira_id = create_jira_issue (args .title , args .parent , args .type , args .version )
131+ jira_id = create_jira_issue (args .title , args .parent , args .type , args .version , args . component )
128132 print ("Created JIRA issue: %s" % jira_id )
129133
130134 create_and_checkout_branch (jira_id )
0 commit comments