Skip to content

Commit 8b94aa2

Browse files
committed
jira-changes.py: generate content for CHANGES.md from jira filter
1 parent 9b76342 commit 8b94aa2

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

‎tools/jira/jira-changes.py‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env python
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information#
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
###############################################################################
19+
#
20+
# Collect Jira issues from a filter and format the output for CHANGES.md
21+
# Output content into console, does not write into file.
22+
#
23+
###############################################################################
24+
"""jira.py: Output jira issues from https://issues.apache.org/jira into RST format for Apche CloudStack Release-Notes.
25+
26+
Usage:
27+
jira.py FILTERID -u USERNAME -p PASSWORD
28+
jira.py (-h | --help)
29+
jira.py --version
30+
31+
Options:
32+
-h --help Show this screen.
33+
--version Show version.
34+
35+
"""
36+
from docopt import docopt
37+
import requests
38+
import json
39+
import sys
40+
import pprint
41+
42+
43+
if __name__ == '__main__':
44+
arguments = docopt(__doc__, version='jira.py 2.0')
45+
46+
filterurl='https://issues.apache.org/jira/rest/api/2/filter/' + arguments['FILTERID']
47+
48+
49+
r=requests.get(filterurl, auth=(arguments['USERNAME'],arguments['PASSWORD']))
50+
rlist=r.json()['searchUrl']
51+
52+
get_all=requests.get(rlist, auth=(arguments['USERNAME'],arguments['PASSWORD'])).json()
53+
count=get_all['total']
54+
55+
#print count
56+
n, m = divmod(count, 50)
57+
58+
for i in range(n+1):
59+
60+
issueslist=requests.get(rlist+'&startAt='+str(i*50), auth=(arguments['USERNAME'],arguments['PASSWORD'])).json()['issues']
61+
62+
for issue in issueslist:
63+
'''assignee=issue['fields']['assignee']['displayName']
64+
reporter=issue['fields']['reporter']['displayName']
65+
'''
66+
print '['+ issue['key'] + '](https://issues.apache.org/jira/browse/' + issue['key'] + ') | ' + issue['fields']['summary'][:80] + '...'

0 commit comments

Comments
 (0)