|
30 | 30 | import urllib.request
|
31 | 31 |
|
32 | 32 | from http.client import HTTPConnection
|
| 33 | +from http.client import HTTPSConnection |
| 34 | + |
33 | 35 |
|
34 | 36 | """
|
35 | 37 | 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):
|
254 | 256 | $ apt-get install rpm # on Ubuntu et.al
|
255 | 257 | """)
|
256 | 258 |
|
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() |
258 | 286 |
|
259 | 287 | def wait_for_node_startup(host='127.0.0.1', port=9200,timeout=15):
|
260 | 288 | for _ in range(timeout):
|
@@ -516,6 +544,7 @@ def check_s3_credentials():
|
516 | 544 |
|
517 | 545 | if build:
|
518 | 546 | release_version = find_release_version(src_branch)
|
| 547 | + ensure_no_open_tickets(release_version) |
519 | 548 | if not dry_run:
|
520 | 549 | smoke_test_version = release_version
|
521 | 550 | head_hash = get_head_hash()
|
|
0 commit comments