Retry more on CI when vendor download fails

This commit is contained in:
Kovid Goyal 2021-01-12 07:36:31 +05:30
parent 1d89aa737a
commit 9b5605c9b9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -28,14 +28,15 @@ class ReVendor(Command):
def download_vendor_release(self, tdir, url): def download_vendor_release(self, tdir, url):
self.info('Downloading %s:' % self.TAR_NAME, url) self.info('Downloading %s:' % self.TAR_NAME, url)
num = 5 if is_ci else 1
for i in range(num):
try: try:
raw = download_securely(url) raw = download_securely(url)
except Exception: except Exception:
if not is_ci: if i == num - 1:
raise raise
self.info('Download failed, sleeping and retrying...') self.info('Download failed, sleeping and retrying...')
time.sleep(2) time.sleep(2)
raw = download_securely(url)
with tarfile.open(fileobj=BytesIO(raw)) as tf: with tarfile.open(fileobj=BytesIO(raw)) as tf:
tf.extractall(tdir) tf.extractall(tdir)
if len(os.listdir(tdir)) == 1: if len(os.listdir(tdir)) == 1: