ci: Retry image building once on failure

The build scripts inside the image retry after a failure. However, there
may be some rare network failures inside the container engine. For
example, when pulling the underlying base image, or when pulling the
docker cache.

Thus, retry after a failure once, which should hopefully fix
https://github.com/bitcoin/bitcoin/issues/33640.
This commit is contained in:
MarcoFalke
2025-10-22 12:10:22 +02:00
parent fa4dbe04d7
commit fa6aa9f42f

View File

@@ -7,6 +7,7 @@ import os
import shlex
import subprocess
import sys
import time
def run(cmd, **kwargs):
@@ -65,7 +66,10 @@ def main():
cmd_build += [os.environ["BASE_READ_ONLY_DIR"]]
print(f"Building {os.environ['CONTAINER_NAME']} image tag to run in")
run(cmd_build)
if run(cmd_build, check=False).returncode != 0:
print(f"Retry building {os.environ['CONTAINER_NAME']} image tag after failure")
time.sleep(3)
run(cmd_build)
run(["./ci/test/02_run_container.sh"]) # run the remainder