|
@@ -10,11 +10,12 @@ import json
|
|
|
import os
|
|
|
import argparse
|
|
|
import io
|
|
|
+import sys
|
|
|
|
|
|
-def fetch():
|
|
|
+def fetch(project_issue_code, jira_project_name):
|
|
|
""" Fetch issues that match given jql query """
|
|
|
# Jira Query Language string which filters for resolved issues of type bug
|
|
|
- jql = 'project = JENKINS '\
|
|
|
+ jql = 'project = ' + project_issue_code + ' ' \
|
|
|
+ 'AND issuetype = Bug '\
|
|
|
+ 'AND status in (Resolved, Closed) '\
|
|
|
+ 'AND resolution = Fixed '\
|
|
@@ -30,7 +31,7 @@ def fetch():
|
|
|
max_results = 1000
|
|
|
|
|
|
os.makedirs('issues/', exist_ok=True)
|
|
|
- request = 'https://issues.jenkins-ci.org/rest/api/2/search?'\
|
|
|
+ request = 'https://' + jira_project_name + '/rest/api/2/search?'\
|
|
|
+ 'jql={}&start_at={}&max_results={}'
|
|
|
|
|
|
# Do small request to establish value of 'total'
|
|
@@ -51,4 +52,15 @@ def fetch():
|
|
|
print('\nDone!')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- fetch()
|
|
|
+
|
|
|
+ parser = argparse.ArgumentParser(description="""Convert a git log output to json.
|
|
|
+ """)
|
|
|
+ parser.add_argument('--issue-code', type=str,
|
|
|
+ help="The code used for the project issues on JIRA: e.g., JENKINS-1123. Only JENKINS needs to be passed as parameter.")
|
|
|
+ parser.add_argument('--jira-project', type=str,
|
|
|
+ help="The name of the Jira repository of the project.")
|
|
|
+
|
|
|
+ args = parser.parse_args()
|
|
|
+ project_issue_code = args.issue_code
|
|
|
+ jira_project_name = args.jira_project
|
|
|
+ fetch(project_issue_code, jira_project_name)
|