Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .evergreen-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ functions:
shell: bash
<<: *e2e_include_expansions_in_env
working_dir: src/github.com/mongodb/mongodb-kubernetes
binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel ${image_name} ${all_agents}
binary: scripts/dev/run_python.sh scripts/release/pipeline_main.py --parallel ${image_name} ${all_agents} ${build_scenario}

# TODO: CLOUDP-335471 ; once all image builds are made with the new atomic pipeline, remove the following function
legacy_pipeline:
Expand Down
7 changes: 4 additions & 3 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,10 @@ tasks:
- func: setup_building_host
- func: quay_login
- func: setup_docker_sbom
- func: legacy_pipeline
- func: pipeline
vars:
image_name: agent
build_scenario: --build-scenario manual_release

- name: run_precommit_and_push
tags: ["patch-run"]
Expand Down Expand Up @@ -543,10 +544,10 @@ tasks:
- func: setup_building_host
- func: quay_login
- func: setup_docker_sbom
- func: legacy_pipeline
- func: pipeline
vars:
image_name: ops-manager
include_tags: release
build_scenario: --build-scenario manual_release

- name: prepare_and_upload_openshift_bundles_for_e2e
commands:
Expand Down
5 changes: 2 additions & 3 deletions build_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
"linux/amd64"
]
},
"release": {
"manual_release": {
"sign": true,
"repository": "quay.io/mongodb/mongodb-agent-ubi",
"platforms": [
Expand All @@ -266,8 +266,7 @@
"linux/amd64"
]
},
"release": {
"version": "om-version-from-release.json",
"manual_release": {
"sign": true,
"repository": "quay.io/mongodb/mongodb-enterprise-ops-manager",
"platforms": [
Expand Down
3 changes: 2 additions & 1 deletion scripts/release/build/build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def load_build_info(
initial_version = get_initial_version()

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

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

# Only update the image_version if it is not already set in the build_info.json file
image_version = scenario_data.get("version")
if not image_version:
if not image_version and version is not None:
image_version = version

images[name] = ImageInfo(
Expand Down
5 changes: 5 additions & 0 deletions scripts/release/build/build_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

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

raise ValueError(f"Unknown build scenario: {self}")
5 changes: 5 additions & 0 deletions scripts/release/pipeline_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ def image_build_config_from_args(args) -> ImageBuildConfiguration:
sign = args.sign or image_build_info.sign
dockerfile_path = image_build_info.dockerfile_path

# Validate version - only ops-manager and agent can have None version
# as they manage versions externally (om_version env var and release.json respectively)
if version is None and image not in ["ops-manager", "agent"]:
raise ValueError(f"Version cannot be empty for {image}.")

return ImageBuildConfiguration(
scenario=build_scenario,
version=version,
Expand Down