Skip to content

Commit

Permalink
promote-assembly: retry on 502
Browse files Browse the repository at this point in the history
  • Loading branch information
vfreex committed Jan 16, 2025
1 parent 9a8d7f5 commit f877f7f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyartcd/pyartcd/pipelines/promote.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from urllib.parse import quote
from ruamel.yaml import YAML
from semver import VersionInfo
from tenacity import (RetryCallState, RetryError, retry,
from tenacity import (RetryCallState, RetryError, retry, retry_if_exception_message,
retry_if_exception_type, retry_if_result,
stop_after_attempt, wait_fixed)

Expand Down Expand Up @@ -1396,8 +1396,12 @@ async def build_release_image(self, release_name: str, arch: str, previous_list:
env = os.environ.copy()
env["GOTRACEBACK"] = "all"
self._logger.info("Running %s", " ".join(cmd))
await exectools.cmd_assert_async(cmd, env=env, stdout=sys.stderr)
pass
return await retry(
reraise=True,
stop=stop_after_attempt(10), # retry 10 times
wait=wait_fixed(30), # wait for 30 seconds between retries
retry=(retry_if_exception_message(match=r".*HTTP status: 502 Bad Gateway")),
)(exectools.cmd_gather_async)(cmd, env=env)

@staticmethod
async def get_image_stream(namespace: str, image_stream: str):
Expand Down

0 comments on commit f877f7f

Please sign in to comment.