Merge "trap another source of fatal errors"
This commit is contained in:
commit
b5d6bc712d
@ -24,6 +24,12 @@ import requests
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
# Turn off warnings for insecure sites, since we'll be talking to
|
||||||
|
# cloud instances anyway.
|
||||||
|
from requests.packages import urllib3
|
||||||
|
urllib3.disable_warnings()
|
||||||
|
|
||||||
|
|
||||||
def get_from_jenkins(job_url, tree=None):
|
def get_from_jenkins(job_url, tree=None):
|
||||||
api_job_url = job_url + "api/json"
|
api_job_url = job_url + "api/json"
|
||||||
if tree:
|
if tree:
|
||||||
@ -67,9 +73,13 @@ def find_job_url(sha=None, retries=30, wait=30):
|
|||||||
def wait_for_completion(job_url, retries=30, wait=30):
|
def wait_for_completion(job_url, retries=30, wait=30):
|
||||||
retry = 0
|
retry = 0
|
||||||
while retry < retries:
|
while retry < retries:
|
||||||
job_json = get_from_jenkins(job_url)
|
try:
|
||||||
if not job_json['building']:
|
job_json = get_from_jenkins(job_url)
|
||||||
return job_json['artifacts'][-1]['displayPath']
|
except Exception as e:
|
||||||
|
print('Failed to get job from jenkins: %s' % e)
|
||||||
|
else:
|
||||||
|
if not job_json['building']:
|
||||||
|
return job_json['artifacts'][-1]['displayPath']
|
||||||
retry += 1
|
retry += 1
|
||||||
time.sleep(wait)
|
time.sleep(wait)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user