build: retry external binary downloads a few times (#24110)
This commit is contained in:
parent
c0182bca15
commit
0b830ba9e5
1 changed files with 8 additions and 3 deletions
|
@ -97,10 +97,15 @@ def sha256(file_path):
|
|||
return hash_256.hexdigest()
|
||||
|
||||
|
||||
def download_binary(base_url, sha, binary_name):
|
||||
def download_binary(base_url, sha, binary_name, attempt=3):
|
||||
full_url = '{0}/{1}/{2}'.format(base_url, sha, binary_name)
|
||||
temp_path = download_to_temp_dir(full_url, filename=binary_name, sha=sha)
|
||||
return temp_path
|
||||
try:
|
||||
temp_path = download_to_temp_dir(full_url, filename=binary_name, sha=sha)
|
||||
return temp_path
|
||||
except Exception as e:
|
||||
if attempt == 1:
|
||||
raise e
|
||||
return download_binary(base_url, sha, binary_name, attempt - 1)
|
||||
|
||||
|
||||
def validate_sha(file_path, sha):
|
||||
|
|
Loading…
Reference in a new issue