File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ def ecr_login_boto3(region: str, account_id: str):
43
43
def ensure_buildx_builder (builder_name : str = DEFAULT_BUILDER_NAME ) -> str :
44
44
"""
45
45
Ensures a Docker Buildx builder exists for multi-platform builds.
46
+ This function is safe for concurrent execution across multiple processes.
46
47
47
48
:param builder_name: Name for the buildx builder
48
49
:return: The builder name that was created or reused
@@ -66,6 +67,13 @@ def ensure_buildx_builder(builder_name: str = DEFAULT_BUILDER_NAME) -> str:
66
67
)
67
68
logger .info (f"Created new buildx builder: { builder_name } " )
68
69
except DockerException as e :
70
+ # Check if this is a race condition (another process created the builder)
71
+ if hasattr (e , 'stderr' ) and 'existing instance for' in str (e .stderr ):
72
+ logger .info (f"Builder '{ builder_name } ' was created by another process – using it." )
73
+ docker .buildx .use (builder_name )
74
+ return builder_name
75
+
76
+ # Otherwise, it's a real error
69
77
logger .error (f"Failed to create buildx builder: { e } " )
70
78
raise
71
79
You can’t perform that action at this time.
0 commit comments