/
createnewandnoteworthy.py
130 lines (98 loc) · 6.8 KB
/
createnewandnoteworthy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
from jira.client import JIRA
import pprint
import urllib
from optparse import OptionParser
pp = pprint.PrettyPrinter(indent=4)
usage = "usage: %prog -u <user> -p <password> --jbide <jbideversion> --jbds <jbdsversions> \nCreates NN jira + subtasks.\nRequires you have installed jira-python (See http://jira-python.readthedocs.org/en/latest/)"
parser = OptionParser(usage)
parser.add_option("-u", "--user", dest="username", help="jira username")
parser.add_option("-p", "--pwd", dest="password", help="jira password")
parser.add_option("-i", "--jbide", dest="jbidefixversion", help="JBIDE fix version")
parser.add_option("-d", "--jbds", dest="jbdsfixversion", help="JBDS fix version")
(options, args) = parser.parse_args()
if not options.username or not options.password or not options.jbidefixversion or not options.jbdsfixversion:
parser.error("Need to specify all")
jira = JIRA(options={'server':'https://issues.jboss.org'}, basic_auth=(options.username, options.password))
jbide_fixversion = options.jbidefixversion
jbds_fixversion = options.jbdsfixversion
## The jql query across for all N&N
nnsearchquery = '((project in (JBDS) and fixVersion = "' + jbds_fixversion + '") or (project in (JBIDE) and fixVersion = "' + jbide_fixversion + '")) AND resolution = Done AND labels = new_and_noteworthy'
nnsearchquery_unlabeled = '((project in (JBDS) and fixVersion = "' + jbds_fixversion + '") or (project in (JBIDE) and fixVersion = "' + jbide_fixversion + '")) AND resolution = Done'
nnsearch = 'https://issues.jboss.org/issues/?jql=' + urllib.quote_plus(nnsearchquery)
nnsearch_unlabeled = 'https://issues.jboss.org/issues/?jql=' + urllib.quote_plus(nnsearchquery_unlabeled)
rootnn_description_milestone = 'This [query|' + nnsearch + '] contains the search for all N&N'
rootnn_description_final = 'This [query|' + nnsearch + '] contains the search for all issues marked N&N. [This|' + mmsearch_unlabeled + '] contains the search for all issues, to help find issues that should be marked n&n but are not.'
if jbide_fixversion.endswith(".Final"):
rootnn_description = rootnn_description_final
else:
rootnn_description = rootnn_description_milestone
rootnn_dict = {
'project' : { 'key': 'JBIDE' },
'summary' : 'Create New and Noteworthy for ' + jbide_fixversion,
'description' : rootnn_description,
'issuetype' : { 'name' : 'Task' },
'priority' : { 'name' :'Blocker'},
'fixVersions' : [{ "name" : jbide_fixversion }],
'components' : [{ "name" : "website" }]
}
#pp.pprint(rootnn_dict)
rootnn = jira.create_issue(fields=rootnn_dict)
print("created " + rootnn.key)
## map from descriptive name to list of JBIDE and/or JBDS components.
## it is assumed if the component name is the same, they are the same across the two jiras
components = {
"BrowserSim" : { "browsersim"},
"Live Reload" : { "livereload" },
"Usage Analytics" : { "usage"},
"Automatic Error reporting" : {"aeri"},
## Outdated? "GWT" : { "gwt"},
"CDI" : { "cdi"},
"Batch": { "batch"},
"Freemarker": {"freemarker"},
"hibernate" : { "hibernate"},
## not needed anymore "JBoss ESB" : { "esb"},
"server" : { "server", "archives", "jmx" },
"jst/jsf": { "jsp/jsf/xml/html-source-editing", "jsf"},
"javascript": { "javascript", "nodejs"},
"Visual Editor": { "visual-page-editor-core", "visual-page-editor-templates"},
"Webservices and Rest": { "webservices"},
"Project Examples": { "project-examples"},
"Maven": { "maven"},
"Forge": { "forge"},
"OpenShift": { "openshift"},
"Docker": { "docker"},
"JBoss Central": { "central"},
"Core/General": { "common/jst/core", "runtime-detection"},
"Easy import": { "easymport"},
"Arquillian": { "arquillian" },
"Aerogear": { "aerogear-hybrid" }
}
def nametuple(x):
return { "name" : x }
def quote(x):
return '"' + x + '"'
for name, comps in components.iteritems():
cms = map(nametuple, comps)
#print name + "->" + str(cms)
compnnsearch = 'https://issues.jboss.org/issues/?jql=' + urllib.quote_plus(nnsearchquery + " and component in (" + ",".join(map(quote,comps)) + ")")
compnnsearch_unlabeled = 'https://issues.jboss.org/issues/?jql=' + urllib.quote_plus(nnsearchquery_unlabeled + " and component in (" + ",".join(map(quote,comps)) + ")")
rootnn_description_milestone = 'This [query|' + compnnsearch + '] contains the search for all issues marked n&n in the specific component(s). To see all issues marked n&n in all components, use this [query|' + nnsearch + '].\n\n If ' + name + ' is not listed here, use [this query|' + compnnsearch_unlabeled + '] to check if there are issues that should be added and add them.\n\n Document the ones relevant for ' + name + ' by adding to [whatsnew|https://github.com/jbosstools/jbosstools-website/tree/master/documentation/whatsnew] and submit a pull request.\n\n If no news for this component please reject and close this issue.'
rootnn_description_final = 'If no news for ' + jbide_fixversion + ' since the last CR release for this component please reject and close this issue. The final N&N page will be aggregated from all previous N&N documents.\n\n If you want to add a comment to the final document then create a separate <component>-news-' + jbide_fixversion + '.adoc file in [whatsnew|https://github.com/jbosstools/jbosstools-website/tree/master/documentation/whatsnew] and submit a pull request. The final N&N page will be aggregated from all previous N&N documents plus this *.Final.adoc.\n\n If you want to replace all previous N&Ns by a new document then create a new <component>-news-' + jbide_fixversion + '.adoc file in [whatsnew|https://github.com/jbosstools/jbosstools-website/tree/master/documentation/whatsnew], add \"page-include-previous: false\" attribute to the document and submit a pull request.\n\n This [query|' + compnnsearch + '] contains the search for all issues marked n&n for the specific component(s). To see all marked n&n, use this [query|' + nnsearch + '].\n\nIf no issues are found, use [this query|' + compnnsearch_unlabeled + '] to check if there are issues that should have the label added to them.'
if jbide_fixversion.endswith(".Final"):
rootnn_description = rootnn_description_final
else:
rootnn_description = rootnn_description_milestone
rootnn_dict = {
'project' : { 'key': 'JBIDE' },
'summary' : name + ' New and Noteworthy for ' + jbide_fixversion,
'description' : rootnn_description,
'issuetype' : { 'name' : 'Sub-task' },
'parent' : { 'id' : rootnn.key},
'priority' : { 'name': 'Critical'},
'components' : cms,
}
#pp.pprint(cms)
child = jira.create_issue(fields=rootnn_dict)
print("created child for " + name + "->" + child.key)
raw_input("Press Enter to delete...or ctrl+c to be ok with the created content")
rootnn.delete(deleteSubtasks=True)