diff options
author | jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> | 2020-11-24 09:51:56 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 09:51:56 -0800 |
commit | ec5491853daed27f2481fc60cf4bdb02ecfddbed (patch) | |
tree | cd4653e0cbc9fe137073bfbe5c0b9e6fa1cc2f7a /infra/build_specified_commit.py | |
parent | a43c85a54c7705b6a59a5a44f95b97346ef1196c (diff) | |
download | oss-fuzz-ec5491853daed27f2481fc60cf4bdb02ecfddbed.tar.gz |
[infra] Add retry decorator and use it. (#4702)
Diffstat (limited to 'infra/build_specified_commit.py')
-rw-r--r-- | infra/build_specified_commit.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/infra/build_specified_commit.py b/infra/build_specified_commit.py index eef671b70..9a0af01ee 100644 --- a/infra/build_specified_commit.py +++ b/infra/build_specified_commit.py @@ -28,10 +28,10 @@ import logging import re import shutil import tempfile -import time import helper import repo_manager +import retry import utils BuildData = collections.namedtuple( @@ -39,7 +39,6 @@ BuildData = collections.namedtuple( _GIT_DIR_MARKER = 'gitdir: ' _IMAGE_BUILD_TRIES = 3 -_IMAGE_BUILD_RETRY_SLEEP = 30.0 class BaseBuilderRepo: @@ -144,17 +143,11 @@ def copy_src_from_docker(project_name, host_dir): return src_dir +@retry.wrap(_IMAGE_BUILD_TRIES, 2, + 'infra.build_specified_commit._build_image_with_retries') def _build_image_with_retries(project_name): """Build image with retries.""" - - for _ in range(_IMAGE_BUILD_TRIES): - result = helper.build_image_impl(project_name) - if result: - return result - - time.sleep(_IMAGE_BUILD_RETRY_SLEEP) - - return result + return helper.build_image_impl(project_name) def get_required_post_checkout_steps(dockerfile_path): |