From 3beb664440843f159e38ef66eb68a7cbd2704dad Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Fri, 2 Aug 2024 09:10:35 +0100 Subject: [PATCH] infra: make it possible to cache docker containers build (#12284) Signed-off-by: David Korczynski --- infra/helper.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/infra/helper.py b/infra/helper.py index 85e26026d..1d03de9e8 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -721,9 +721,14 @@ def docker_run(run_args, print_output=True, architecture='x86_64'): """Calls `docker run`.""" platform = 'linux/arm64' if architecture == 'aarch64' else 'linux/amd64' command = [ - 'docker', 'run', '--rm', '--privileged', '--shm-size=2g', '--platform', - platform + 'docker', 'run', '--privileged', '--shm-size=2g', '--platform', platform ] + if os.getenv('OSS_FUZZ_SAVE_CONTAINERS_NAME'): + command.append('--name') + command.append(os.getenv('OSS_FUZZ_SAVE_CONTAINERS_NAME')) + else: + command.append('--rm') + # Support environments with a TTY. if sys.stdin.isatty(): command.append('-i')