Skip to content

Commit 4d4e4e9

Browse files
committed
Remove args iteration for multi platform
1 parent 03062c3 commit 4d4e4e9

File tree

3 files changed

+27
-50
lines changed

3 files changed

+27
-50
lines changed

docker/mongodb-kubernetes-readinessprobe/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ WORKDIR /go/src
44
ADD . .
55

66
ARG TARGETARCH
7-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o /data/scripts/readinessprobe ./mongodb-community-operator/cmd/readiness/main.go
7+
ARG TARGETOS
8+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o /data/scripts/readinessprobe ./mongodb-community-operator/cmd/readiness/main.go
89

910
FROM registry.access.redhat.com/ubi9/ubi-minimal
1011

docker/mongodb-kubernetes-upgrade-hook/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ WORKDIR /go/src
44
ADD . .
55

66
ARG TARGETARCH
7-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o /data/scripts/version-upgrade-hook ./mongodb-community-operator/cmd/versionhook/main.go
7+
ARG TARGETOS
8+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o /data/scripts/version-upgrade-hook ./mongodb-community-operator/cmd/versionhook/main.go
89

910
FROM registry.access.redhat.com/ubi9/ubi-minimal
1011

scripts/release/atomic_pipeline.py

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -364,34 +364,29 @@ def build_image_generic(
364364
dockerfile_path: str,
365365
build_configuration: BuildConfiguration,
366366
extra_args: dict | None = None,
367-
multi_arch_args_list: list[dict] | None = None,
368-
is_multi_arch: bool = False,
369367
):
370368
"""
371369
Build one or more platform-specific images, then (optionally)
372370
push a manifest and sign the result.
373371
"""
374372

375373
registry = build_configuration.base_registry
376-
args_list = multi_arch_args_list or [extra_args or {}]
377-
version = args_list[0].get("version", "")
378-
platforms = [args.get("architecture") for args in args_list]
379-
380-
for base_args in args_list:
381-
# merge in the registry without mutating caller’s dict
382-
build_args = {**base_args, "quay_registry": registry}
383-
logger.debug(f"Build args: {build_args}")
384-
385-
for arch in platforms:
386-
logger.debug(f"Building {image_name} for arch={arch}")
387-
logger.debug(f"build image generic - registry={registry}")
388-
pipeline_process_image(
389-
image_name=image_name,
390-
dockerfile_path=dockerfile_path,
391-
build_configuration=build_configuration,
392-
dockerfile_args=build_args,
393-
with_sbom=False, # TODO: specify no SBOM, write folllow up tasks and todo
394-
)
374+
args_list = extra_args or {}
375+
version = args_list.get("version", "")
376+
377+
# merge in the registry without mutating caller’s dict
378+
build_args = {**args_list, "quay_registry": registry}
379+
logger.debug(f"Build args: {build_args}")
380+
381+
logger.debug(f"Building {image_name} for platforms={build_configuration.platforms}")
382+
logger.debug(f"build image generic - registry={registry}")
383+
pipeline_process_image(
384+
image_name=image_name,
385+
dockerfile_path=dockerfile_path,
386+
build_configuration=build_configuration,
387+
dockerfile_args=build_args,
388+
with_sbom=False, # TODO: specify no SBOM, write folllow up tasks and todo
389+
)
395390

396391
if build_configuration.sign:
397392
sign_image(registry, version)
@@ -441,41 +436,21 @@ def build_community_image(build_configuration: BuildConfiguration, image_type: s
441436
image_name = "mongodb-kubernetes-operator-version-upgrade-post-start-hook"
442437
dockerfile_path = "docker/mongodb-kubernetes-upgrade-hook/Dockerfile"
443438
else:
444-
raise ValueError(f"Unsupported image type: {image_type}")
439+
raise ValueError(f"Unsupported community image type: {image_type}")
445440

446441
version = build_configuration.version
447442
golang_version = os.getenv("GOLANG_VERSION", "1.24")
448443

449-
# Use only amd64 if we should skip arm64 builds
450-
if should_skip_arm64():
451-
platforms = ["linux/amd64"]
452-
logger.info("Skipping ARM64 builds for community image as this is running in EVG pipeline as a patch")
453-
else:
454-
platforms = build_configuration.platforms or ["linux/amd64", "linux/arm64"]
455-
456-
# Extract architectures from platforms for build args
457-
architectures = [platform.split("/")[-1] for platform in platforms]
458-
multi_arch_args_list = []
459-
460-
for arch in architectures:
461-
arch_args = {
462-
"version": version,
463-
"GOLANG_VERSION": golang_version,
464-
"architecture": arch,
465-
"TARGETARCH": arch, # TODO: redundant ?
466-
}
467-
multi_arch_args_list.append(arch_args)
468-
469-
# Create a copy of build_configuration with overridden platforms
470-
build_config_copy = copy(build_configuration)
471-
build_config_copy.platforms = platforms
444+
extra_args = {
445+
"version": version,
446+
"GOLANG_VERSION": golang_version,
447+
}
472448

473449
build_image_generic(
474450
image_name=image_name,
475451
dockerfile_path=dockerfile_path,
476-
build_configuration=build_config_copy,
477-
multi_arch_args_list=multi_arch_args_list,
478-
is_multi_arch=True,
452+
build_configuration=build_configuration,
453+
extra_args=extra_args,
479454
)
480455

481456

0 commit comments

Comments
 (0)