Skip to content

Commit 14c5391

Browse files
committed
All images build pass on EVG
1 parent 6de1000 commit 14c5391

File tree

2 files changed

+60
-26
lines changed

2 files changed

+60
-26
lines changed

scripts/release/atomic_pipeline.py

Lines changed: 60 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
--include operator \
2121
--include mco-test \
2222
--include readiness-probe \
23-
--include upgrade-hook \
2423
--include operator-quick \
2524
--include database \
2625
--include init-appdb \
@@ -44,7 +43,10 @@
4443
The biggest mess is the agent builds
4544
4645
TODO:
46+
- start using new pipeline into patches build
47+
- open PR with the minimal set of changes required to build a simple image
4748
- continue to clean pipeline
49+
- we don't use readiness probe and version upgrade hook anymore, but they are "base" images for some init image
4850
"""
4951

5052
import json
@@ -241,11 +243,13 @@ def check_multi_arch(image: str, suffix: str) -> bool:
241243
@TRACER.start_as_current_span("sonar_build_image")
242244
def pipeline_process_image(
243245
image_name: str,
246+
image_tag: str, # TODO how to define tag properly
244247
dockerfile_path: str,
245248
dockerfile_args: Dict[str, str] = None,
246249
base_registry: str = None,
247250
architecture=None,
248251
sign: bool = False,
252+
build_path: str = ".",
249253
with_sbom: bool = True,
250254
):
251255
"""Builds a Docker image with arguments defined in `args`."""
@@ -269,11 +273,13 @@ def pipeline_process_image(
269273
logger.debug(f"Build args: {dockerfile_args}")
270274
process_image(
271275
image_name,
276+
image_tag=image_tag,
272277
dockerfile_path=dockerfile_path,
273278
dockerfile_args=dockerfile_args,
274279
base_registry=base_registry,
275280
architecture=architecture,
276281
sign=sign,
282+
build_path=build_path,
277283
)
278284

279285
if with_sbom:
@@ -345,10 +351,18 @@ def build_tests_image(build_configuration: BuildConfiguration):
345351
if python_version == "":
346352
raise Exception("Missing PYTHON_VERSION environment variable")
347353

348-
buildargs = dict({"python_version": python_version})
354+
buildargs = dict({"PYTHON_VERSION": python_version})
349355

356+
image_tag, _ = get_git_release_tag() # TODO: correct tag for test image ?
350357
# TODO: don't allow test images to be released to Quay
351-
pipeline_process_image(image_name, "docker/mongodb-kubernetes-tests/Dockerfile", buildargs, base_registry=build_configuration.base_registry)
358+
pipeline_process_image(
359+
image_name,
360+
image_tag=image_tag,
361+
dockerfile_path="Dockerfile",
362+
dockerfile_args=buildargs,
363+
base_registry=build_configuration.base_registry,
364+
build_path="docker/mongodb-kubernetes-tests",
365+
)
352366

353367

354368
def build_mco_tests_image(build_configuration: BuildConfiguration):
@@ -362,7 +376,14 @@ def build_mco_tests_image(build_configuration: BuildConfiguration):
362376

363377
buildargs = dict({"GOLANG_VERSION": golang_version})
364378

365-
pipeline_process_image(image_name, "docker/mongodb-community-tests/Dockerfile", buildargs, base_registry=build_configuration.base_registry)
379+
image_tag, _ = get_git_release_tag() # TODO: correct tag for test image ?
380+
pipeline_process_image(
381+
image_name,
382+
image_tag=image_tag,
383+
dockerfile_path="docker/mongodb-community-tests/Dockerfile",
384+
dockerfile_args=buildargs,
385+
base_registry=build_configuration.base_registry,
386+
)
366387

367388

368389
def build_operator_image(build_configuration: BuildConfiguration):
@@ -403,8 +424,15 @@ def build_database_image(build_configuration: BuildConfiguration):
403424
"""
404425
release = get_release()
405426
version = release["databaseImageVersion"]
427+
version, _ = get_git_release_tag() # TODO: check how to properly retrieve version
406428
args = {"version": version}
407-
build_image_generic(image_name="mongodb-kubernetes-database", dockerfile_path="docker/mongodb-kubernetes-database/Dockerfile", registry_address=build_configuration.base_registry, extra_args=args, sign=build_configuration.sign)
429+
build_image_generic(
430+
image_name="mongodb-kubernetes-database",
431+
dockerfile_path="docker/mongodb-kubernetes-database/Dockerfile",
432+
registry_address=build_configuration.base_registry,
433+
extra_args=args,
434+
sign=build_configuration.sign,
435+
)
408436

409437

410438
def build_CLI_SBOM(build_configuration: BuildConfiguration):
@@ -429,8 +457,6 @@ def build_CLI_SBOM(build_configuration: BuildConfiguration):
429457
generate_sbom_for_cli(version, architecture)
430458

431459

432-
433-
434460
def should_skip_arm64():
435461
"""
436462
Determines if arm64 builds should be skipped based on environment.
@@ -496,8 +522,9 @@ def find_om_url(om_version: str) -> str:
496522

497523
def build_init_om_image(build_configuration: BuildConfiguration):
498524
release = get_release()
499-
init_om_version = release["initOpsManagerVersion"]
500-
args = {"version": init_om_version}
525+
version = release["initOpsManagerVersion"]
526+
version, _ = get_git_release_tag() # TODO: check how to properly retrieve version
527+
args = {"version": version}
501528
build_image_generic(
502529
"mongodb-kubernetes-init-ops-manager",
503530
"docker/mongodb-kubernetes-init-ops-manager/Dockerfile",
@@ -562,10 +589,11 @@ def build_image_generic(
562589
logger.debug(f"Building {image_name} for arch={arch}")
563590
logger.debug(f"build image generic - registry={registry}")
564591
pipeline_process_image(
565-
image_name,
566-
dockerfile_path,
567-
build_args,
568-
registry,
592+
image_name=image_name,
593+
image_tag=version,
594+
dockerfile_path=dockerfile_path,
595+
dockerfile_args=build_args,
596+
base_registry=registry,
569597
architecture=arch,
570598
sign=False,
571599
with_sbom=False,
@@ -586,6 +614,7 @@ def build_init_appdb(build_configuration: BuildConfiguration):
586614
version = release["initAppDbVersion"]
587615
base_url = "https://fastdl.mongodb.org/tools/db/"
588616
mongodb_tools_url_ubi = "{}{}".format(base_url, release["mongodbToolsBundle"]["ubi"])
617+
version, _ = get_git_release_tag() # TODO: check how to properly retrieve version
589618
args = {"version": version, "is_appdb": True, "mongodb_tools_url_ubi": mongodb_tools_url_ubi}
590619
build_image_generic(
591620
"mongodb-kubernetes-init-appdb",
@@ -739,7 +768,7 @@ def build_multi_arch_agent_in_sonar(
739768
sign=build_configuration.sign,
740769
)
741770

742-
771+
# TODO: figure out why I hit toomanyrequests: Rate exceeded with the new pipeline
743772
def build_agent_default_case(build_configuration: BuildConfiguration):
744773
"""
745774
Build the agent only for the latest operator for patches and operator releases.
@@ -770,15 +799,15 @@ def build_agent_default_case(build_configuration: BuildConfiguration):
770799
for agent_version in agent_versions_to_build:
771800
# We don't need to keep create and push the same image on every build.
772801
# It is enough to create and push the non-operator suffixed images only during releases to ecr and quay.
773-
if build_configuration.is_release_step_executed() or build_configuration.all_agents:
774-
tasks_queue.put(
775-
executor.submit(
776-
build_multi_arch_agent_in_sonar,
777-
build_configuration,
778-
agent_version[0],
779-
agent_version[1],
780-
)
781-
)
802+
# if build_configuration.is_release_step_executed() or build_configuration.all_agents:
803+
# tasks_queue.put(
804+
# executor.submit(
805+
# build_multi_arch_agent_in_sonar,
806+
# build_configuration,
807+
# agent_version[0],
808+
# agent_version[1],
809+
# )
810+
# )
782811
_build_agent_operator(
783812
agent_version, build_configuration, executor, operator_version, tasks_queue, is_release
784813
)
@@ -890,7 +919,8 @@ def _build_agent_operator(
890919
# We could rely on input params (quay_registry or registry), but it makes templating more complex in the inventory
891920
non_quay_registry = os.environ.get("REGISTRY", "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev")
892921
base_init_database_repo = QUAY_REGISTRY_URL if use_quay else non_quay_registry
893-
init_database_image = f"{base_init_database_repo}/mongodb-kubernetes-init-database:{operator_version}"
922+
TEMP_HARDCODED_BASE_REGISTRY = "268558157000.dkr.ecr.us-east-1.amazonaws.com/julienben/staging-temp"
923+
init_database_image = f"{TEMP_HARDCODED_BASE_REGISTRY}/mongodb-kubernetes-init-database:{operator_version}"
894924

895925
tasks_queue.put(
896926
executor.submit(
@@ -1000,9 +1030,14 @@ def build_init_database(build_configuration: BuildConfiguration):
10001030
version = release["initDatabaseVersion"] # comes from release.json
10011031
base_url = "https://fastdl.mongodb.org/tools/db/"
10021032
mongodb_tools_url_ubi = "{}{}".format(base_url, release["mongodbToolsBundle"]["ubi"])
1033+
version, _ = get_git_release_tag() # TODO: check how to properly retrieve version
10031034
args = {"version": version, "mongodb_tools_url_ubi": mongodb_tools_url_ubi, "is_appdb": False}
10041035
build_image_generic(
1005-
"mongodb-kubernetes-init-database", "docker/mongodb-kubernetes-init-database/Dockerfile", registry_address=build_configuration.base_registry, extra_args=args, sign=build_configuration.sign
1036+
"mongodb-kubernetes-init-database",
1037+
"docker/mongodb-kubernetes-init-database/Dockerfile",
1038+
registry_address=build_configuration.base_registry,
1039+
extra_args=args,
1040+
sign=build_configuration.sign,
10061041
)
10071042

10081043

scripts/release/build_images.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def build_image(docker_client: docker.DockerClient, tag: str, dockerfile: str, p
5858
path=path,
5959
dockerfile=dockerfile,
6060
tag=tag,
61-
rm=True, # remove intermediate containers after a successful build
6261
pull=False, # set True to always attempt to pull a newer base image
6362
buildargs=args,
6463
)

0 commit comments

Comments
 (0)