Skip to content

Commit d047de5

Browse files
committed
Merge branch 'julienben/redesign-pipeline' into maciejk/use-ar-related-versions
# Conflicts: # scripts/release/atomic_pipeline.py # scripts/release/build/image_build_process.py # scripts/release/pipeline_main.py
2 parents e117f79 + 2125cb7 commit d047de5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

scripts/release/build/image_build_process.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def ecr_login_boto3(region: str, account_id: str):
4343
def 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.
4746
4847
:param builder_name: Name for the buildx builder
4948
:return: The builder name that was created or reused
@@ -67,13 +66,6 @@ def ensure_buildx_builder(builder_name: str = DEFAULT_BUILDER_NAME) -> str:
6766
)
6867
logger.info(f"Created new buildx builder: {builder_name}")
6968
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
7769
logger.error(f"Failed to create buildx builder: {e}")
7870
raise
7971

@@ -119,10 +111,7 @@ def execute_docker_build(
119111
if len(platforms) > 1:
120112
logger.info(f"Multi-platform build for {len(platforms)} architectures")
121113

122-
# Ensure buildx builder exists (safe for concurrent execution)
123-
ensure_buildx_builder(builder_name)
124-
125-
# Build the image using buildx
114+
# Build the image using buildx, builder must be already initialized
126115
docker_cmd.buildx.build(
127116
context_path=path,
128117
file=dockerfile,

scripts/release/pipeline_main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
SUPPORTED_PLATFORMS,
5050
ImageBuildConfiguration,
5151
)
52+
from scripts.release.build.image_build_process import (
53+
DEFAULT_BUILDER_NAME,
54+
ensure_buildx_builder,
55+
)
5256

5357
"""
5458
The goal of main.py, image_build_configuration.py and build_context.py is to provide a single source of truth for the build
@@ -209,6 +213,10 @@ def main():
209213
logger.info(f"Building image: {args.image}")
210214
logger.info(f"Build configuration: {build_config}")
211215

216+
# Create buildx builder
217+
# It must be initialized here as opposed to in build_images.py so that parallel calls (such as agent builds) can access it
218+
# and not face race conditions
219+
ensure_buildx_builder(DEFAULT_BUILDER_NAME)
212220
build_image(args.image, build_config)
213221

214222

0 commit comments

Comments
 (0)