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):
4343def ensure_buildx_builder (builder_name : str = DEFAULT_BUILDER_NAME ) -> str :
4444 """
4545 Ensures a Docker Buildx builder exists for multi-platform builds.
46+ This function is safe for concurrent execution across multiple processes.
4647
4748 :param builder_name: Name for the buildx builder
4849 :return: The builder name that was created or reused
@@ -66,6 +67,13 @@ def ensure_buildx_builder(builder_name: str = DEFAULT_BUILDER_NAME) -> str:
6667 )
6768 logger .info (f"Created new buildx builder: { builder_name } " )
6869 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
6977 logger .error (f"Failed to create buildx builder: { e } " )
7078 raise
7179
You can’t perform that action at this time.
0 commit comments