Skip to content

Commit 32d1528

Browse files
authored
feat: Remove retries from docker build (#2500)
1 parent 3f7fcb9 commit 32d1528

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

toolchains/sysimage/build_container_filesystem_tar.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
import argparse
77
import os
88
import shutil
9-
import sys
10-
import time
119
from dataclasses import dataclass
1210
from pathlib import Path
13-
from typing import Callable, List, Optional, TypeVar
11+
from typing import List, Optional, TypeVar
1412

1513
import invoke
1614

@@ -37,27 +35,6 @@ def __post_init__(self):
3735
ReturnType = TypeVar("ReturnType") # https://docs.python.org/3/library/typing.html#generics
3836

3937

40-
def retry(func: Callable[[], ReturnType], num_retries: int = 3) -> ReturnType:
41-
"""
42-
Call the given `func`. If an exception is raised, print, and retry `num_retries` times.
43-
Back off retries by sleeping for at least 5 secs + an exponential increase.
44-
Exception is not caught on the last try.
45-
"""
46-
BASE_BACKOFF_WAIT_SECS = 5
47-
for i in range(num_retries):
48-
try:
49-
return func()
50-
except Exception as e:
51-
print(f"Exception occurred: {e}", file=sys.stderr)
52-
print(f"Retries left: {num_retries - i}", file=sys.stderr)
53-
wait_time_secs = BASE_BACKOFF_WAIT_SECS + i**2
54-
print(f"Waiting for next retry (secs): {wait_time_secs}")
55-
time.sleep(wait_time_secs) # 5, 6, 9, 14, 21, etc.
56-
57-
# Let the final try actually throw
58-
return func()
59-
60-
6138
def load_base_image_tar_file(container_cmd: str, tar_file: Path):
6239
"""
6340
Load the filesystem in the tar file into the podman repo.
@@ -117,10 +94,7 @@ def build_container(
11794
cmd += f"{context_dir} "
11895
print(cmd)
11996

120-
def build_func():
121-
invoke.run(cmd) # Throws on failure
122-
123-
retry(build_func)
97+
invoke.run(cmd) # Throws on failure
12498
return image_tag
12599

126100

0 commit comments

Comments
 (0)