Skip to content

Commit 8338fc3

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongodb-kubernetes into support-multiple-registries-master
2 parents d2221ef + 355e63d commit 8338fc3

File tree

7 files changed

+49
-39
lines changed

7 files changed

+49
-39
lines changed

.evergreen-functions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ functions:
524524
shell: bash
525525
<<: *e2e_include_expansions_in_env
526526
working_dir: src/github.com/mongodb/mongodb-kubernetes
527-
binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel ${image_name} ${all_agents}
527+
binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel ${image_name} ${all_agents} ${build_scenario}
528528

529529
# TODO: CLOUDP-335471 ; once all image builds are made with the new atomic pipeline, remove the following function
530530
legacy_pipeline:

.evergreen.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ variables:
3333
variant: init_test_run
3434
- name: build_init_om_images_ubi
3535
variant: init_test_run
36-
- name: build_agent_images_ubi
37-
variant: init_test_run
3836

3937
- &base_no_om_image_dependency
4038
depends_on:
@@ -52,8 +50,6 @@ variables:
5250
variant: init_test_run
5351
- name: build_init_appdb_images_ubi
5452
variant: init_test_run
55-
- name: build_agent_images_ubi
56-
variant: init_test_run
5753

5854
- &community_dependency
5955
depends_on:
@@ -67,8 +63,6 @@ variables:
6763
variant: init_test_run
6864
- name: build_mco_test_image
6965
variant: init_test_run
70-
- name: build_agent_images_ubi
71-
variant: init_test_run
7266

7367
- &setup_group
7468
setup_group_can_fail_task: true
@@ -153,8 +147,6 @@ variables:
153147
variant: init_test_run
154148
- name: build_init_om_images_ubi
155149
variant: init_test_run
156-
- name: build_agent_images_ubi
157-
variant: init_test_run
158150

159151
- &base_om7_dependency_with_race
160152
depends_on:
@@ -172,8 +164,6 @@ variables:
172164
variant: init_test_run
173165
- name: build_init_om_images_ubi
174166
variant: init_test_run
175-
- name: build_agent_images_ubi
176-
variant: init_test_run
177167

178168
- &base_om8_dependency
179169
depends_on:
@@ -191,8 +181,6 @@ variables:
191181
variant: init_test_run
192182
- name: build_init_om_images_ubi
193183
variant: init_test_run
194-
- name: build_agent_images_ubi
195-
variant: init_test_run
196184

197185
parameters:
198186
- key: evergreen_retry
@@ -356,9 +344,10 @@ tasks:
356344
- func: setup_building_host
357345
- func: quay_login
358346
- func: setup_docker_sbom
359-
- func: legacy_pipeline
347+
- func: pipeline
360348
vars:
361349
image_name: agent
350+
build_scenario: --build-scenario manual_release
362351

363352
- name: run_precommit_and_push
364353
tags: ["patch-run"]
@@ -543,10 +532,10 @@ tasks:
543532
- func: setup_building_host
544533
- func: quay_login
545534
- func: setup_docker_sbom
546-
- func: legacy_pipeline
535+
- func: pipeline
547536
vars:
548537
image_name: ops-manager
549-
include_tags: release
538+
build_scenario: --build-scenario manual_release
550539

551540
- name: prepare_and_upload_openshift_bundles_for_e2e
552541
commands:
@@ -1547,8 +1536,6 @@ buildvariants:
15471536
variant: init_test_run
15481537
- name: prepare_and_upload_openshift_bundles_for_e2e
15491538
variant: init_tests_with_olm
1550-
- name: build_agent_images_ubi
1551-
variant: init_test_run
15521539
tasks:
15531540
- name: e2e_kind_olm_group
15541541

@@ -1572,9 +1559,6 @@ buildvariants:
15721559
variant: init_tests_with_olm
15731560
- name: build_init_database_image_ubi
15741561
variant: init_test_run
1575-
- name: build_agent_images_ubi
1576-
variant: init_test_run
1577-
15781562
tasks:
15791563
- name: e2e_kind_olm_group
15801564

build_info.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
"linux/amd64"
241241
]
242242
},
243-
"release": {
243+
"manual_release": {
244244
"sign": true,
245245
"repository": ["quay.io/mongodb/mongodb-agent-ubi"],
246246
"platforms": [
@@ -266,8 +266,7 @@
266266
"linux/amd64"
267267
]
268268
},
269-
"release": {
270-
"version": "om-version-from-release.json",
269+
"manual_release": {
271270
"sign": true,
272271
"repository": ["quay.io/mongodb/mongodb-enterprise-ops-manager"],
273272
"platforms": [

scripts/release/build/build_info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def load_build_info(
8080
initial_version = get_initial_version()
8181

8282
version = scenario.get_version(repository_path, changelog_sub_path, initial_commit_sha, initial_version)
83+
# For manual_release, version can be None and will be set by image-specific logic
8384

8485
with open("build_info.json", "r") as f:
8586
build_info = json.load(f)
@@ -98,7 +99,7 @@ def load_build_info(
9899

99100
# Only update the image_version if it is not already set in the build_info.json file
100101
image_version = scenario_data.get("version")
101-
if not image_version:
102+
if not image_version and version is not None:
102103
image_version = version
103104

104105
images[name] = ImageInfo(

scripts/release/build/build_scenario.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
class BuildScenario(StrEnum):
1313
RELEASE = "release" # Official release triggered by a git tag
14+
MANUAL_RELEASE = "manual_release" # Manual release, not part of operator release cycle
1415
PATCH = "patch" # CI build for a patch/pull request
1516
STAGING = "staging" # CI build from a merge to the master
1617
DEVELOPMENT = "development" # Local build on a developer machine
@@ -58,5 +59,9 @@ def get_version(self, repository_path: str, changelog_sub_path: str, initial_com
5859
return repo.head.object.hexsha[:COMMIT_SHA_LENGTH]
5960
case BuildScenario.RELEASE:
6061
return calculate_next_version(repo, changelog_sub_path, initial_commit_sha, initial_version)
62+
case BuildScenario.MANUAL_RELEASE:
63+
# For manual releases, version must be provided externally (e.g., for ops-manager via om_version env var,
64+
# for agent via release.json). Return None to indicate version will be set by image-specific logic.
65+
return None
6166

6267
raise ValueError(f"Unknown build scenario: {self}")

scripts/release/pipeline_main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration:
114114
sign = args.sign or image_build_info.sign
115115
dockerfile_path = image_build_info.dockerfile_path
116116

117+
# Validate version - only ops-manager and agent can have None version as the versions are managed by the agent
118+
# and om methods themselves, which are externally retrieved - om_version env var and release.json respectively
119+
if version is None and image not in ["ops-manager", "agent"]:
120+
raise ValueError(f"Version cannot be empty for {image}.")
121+
117122
return ImageBuildConfiguration(
118123
scenario=build_scenario,
119124
version=version,

scripts/release/tests/build_info_test.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -414,20 +414,6 @@ def test_load_build_info_release(
414414
dockerfile_path="docker/mongodb-kubernetes-upgrade-hook/Dockerfile.atomic",
415415
sign=True,
416416
),
417-
"agent": ImageInfo(
418-
repository=["quay.io/mongodb/mongodb-agent-ubi"],
419-
platforms=["linux/arm64", "linux/amd64"],
420-
version=version,
421-
dockerfile_path="docker/mongodb-agent/Dockerfile.atomic",
422-
sign=True,
423-
),
424-
"ops-manager": ImageInfo(
425-
repository=["quay.io/mongodb/mongodb-enterprise-ops-manager"],
426-
platforms=["linux/amd64"],
427-
version="om-version-from-release.json",
428-
dockerfile_path="docker/mongodb-enterprise-ops-manager/Dockerfile.atomic",
429-
sign=True,
430-
),
431417
},
432418
binaries={
433419
"kubectl-mongodb": BinaryInfo(
@@ -449,3 +435,33 @@ def test_load_build_info_release(
449435
build_info = load_build_info(BuildScenario.RELEASE, git_repo.working_dir)
450436

451437
assert build_info == expected_build_info
438+
439+
440+
def test_load_build_info_manual_release(git_repo: Repo):
441+
version = "1.2.0"
442+
git_repo.git.checkout(version)
443+
444+
expected_build_info = BuildInfo(
445+
images={
446+
"agent": ImageInfo(
447+
repository=["quay.io/mongodb/mongodb-agent-ubi"],
448+
platforms=["linux/arm64", "linux/amd64"],
449+
version=None, # Version is None for manual_release scenario
450+
dockerfile_path="docker/mongodb-agent/Dockerfile.atomic",
451+
sign=True,
452+
),
453+
"ops-manager": ImageInfo(
454+
repository=["quay.io/mongodb/mongodb-enterprise-ops-manager"],
455+
platforms=["linux/amd64"],
456+
version=None, # Version is None for manual_release scenario
457+
dockerfile_path="docker/mongodb-enterprise-ops-manager/Dockerfile.atomic",
458+
sign=True,
459+
),
460+
},
461+
binaries={},
462+
helm_charts={},
463+
)
464+
465+
build_info = load_build_info(BuildScenario.MANUAL_RELEASE, git_repo.working_dir)
466+
467+
assert build_info == expected_build_info

0 commit comments

Comments
 (0)