Skip to content

Commit 11bf13c

Browse files
committed
Check for no open issues before build release
1 parent 754eb16 commit 11bf13c

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

dev-tools/build_release.py

+30-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import urllib.request
3131

3232
from http.client import HTTPConnection
33+
from http.client import HTTPSConnection
34+
3335

3436
"""
3537
This tool builds a release from the a given elasticsearch branch.
@@ -254,7 +256,33 @@ def build_release(run_tests=False, dry_run=True, cpus=1):
254256
$ apt-get install rpm # on Ubuntu et.al
255257
""")
256258

257-
259+
# Uses the github API to fetch open tickets for the given release version
260+
# if it finds any tickets open for that version it will throw an exception
261+
def ensure_no_open_tickets(version):
262+
version = "v%s" % version
263+
conn = HTTPSConnection('api.github.com')
264+
try:
265+
log('Checking for open tickets on Github for version %s' % version)
266+
log('Check if node is available')
267+
print( 'https://api.github.com:443/repos/elasticsearch/elasticsearch/issues?state=open&labels=%s' % version)
268+
conn.request('GET', '/repos/elasticsearch/elasticsearch/issues?state=open&labels=%s' % version, headers= {'User-Agent' : 'Elasticsearch version checker'})
269+
res = conn.getresponse()
270+
if res.status == 200:
271+
issues = json.loads(res.read().decode("utf-8"))
272+
if issues:
273+
urls = []
274+
for issue in issues:
275+
urls.append(issue['url'])
276+
raise RuntimeError('Found open issues for release version %s see - %s' % (version, urls))
277+
else:
278+
log("No open issues found for version %s" % version)
279+
else:
280+
raise RuntimeError('Failed to fetch issue list from Github for release version %s' % version)
281+
except socket.error as e:
282+
log("Failed to fetch issue list from Github for release version %s' % version - Exception: [%s]" % (version, e))
283+
#that is ok it might not be there yet
284+
finally:
285+
conn.close()
258286

259287
def wait_for_node_startup(host='127.0.0.1', port=9200,timeout=15):
260288
for _ in range(timeout):
@@ -516,6 +544,7 @@ def check_s3_credentials():
516544

517545
if build:
518546
release_version = find_release_version(src_branch)
547+
ensure_no_open_tickets(release_version)
519548
if not dry_run:
520549
smoke_test_version = release_version
521550
head_hash = get_head_hash()

0 commit comments

Comments
 (0)