From 754dff0b5c152c8e8c9cac6004d6967a86962909 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Fri, 30 Jan 2026 13:40:32 +0100 Subject: [PATCH] fix: race condition in docker_image transforms With transforms potentially running in parallel, the docker-contexts existence check can race with makedirs() in another process. --- src/taskgraph/transforms/docker_image.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/taskgraph/transforms/docker_image.py b/src/taskgraph/transforms/docker_image.py index 8ded711ac..1dc8ee7b1 100644 --- a/src/taskgraph/transforms/docker_image.py +++ b/src/taskgraph/transforms/docker_image.py @@ -126,8 +126,7 @@ def fill_template(config, tasks): context_hashes = {} if not taskgraph.fast and config.write_artifacts: - if not os.path.isdir(CONTEXTS_DIR): - os.makedirs(CONTEXTS_DIR) + os.makedirs(CONTEXTS_DIR, exist_ok=True) for task in tasks: image_name = task.pop("name")