Skip to content

Fix release scripts #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 inventories/database.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vars:
quay_registry: quay.io/mongodb/mongodb-kubernetes-database
s3_bucket: s3://enterprise-operator-dockerfiles/dockerfiles/mongodb-enterprise-database
s3_bucket: s3://enterprise-operator-dockerfiles/dockerfiles/mongodb-kubernetes-database

images:
- name: database
Expand Down
6 changes: 3 additions & 3 deletions inventory.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
vars:
registry: <container-registry>
quay_registry: quay.io/mongodb/mongodb-enterprise-operator
s3_bucket: s3://enterprise-operator-dockerfiles/dockerfiles/mongodb-enterprise-operator
quay_registry: quay.io/mongodb/mongodb-kubernetes
s3_bucket: s3://enterprise-operator-dockerfiles/dockerfiles/mongodb-kubernetes

images:
- name: operator
- name: mongodb-kubernetes
vars:
context: .
template_context: docker/mongodb-enterprise-operator
Expand Down
17 changes: 11 additions & 6 deletions pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,14 @@ def build_operator_image(build_configuration: BuildConfiguration):

logger.info(f"Building Operator args: {args}")

build_image_generic(build_configuration, "operator", "inventory.yaml", args)
image_name = "mongodb-kubernetes"
build_image_generic(
config=build_configuration,
image_name=image_name,
inventory_file="inventory.yaml",
extra_args=args,
registry_address=f"{QUAY_REGISTRY_URL}/{image_name}",
)


def build_database_image(build_configuration: BuildConfiguration):
Expand Down Expand Up @@ -549,9 +556,7 @@ def build_operator_image_patch(build_configuration: BuildConfiguration):

client = docker.from_env()
# image that we know is where we build operator.
image_repo = (
build_configuration.base_repository + "/" + build_configuration.image_type + "/mongodb-enterprise-operator"
)
image_repo = build_configuration.base_repository + "/" + build_configuration.image_type + "/mongodb-kubernetes"
image_tag = "latest"
repo_tag = image_repo + ":" + image_tag

Expand Down Expand Up @@ -976,7 +981,7 @@ def build_image_generic(
multi_arch_args_list = [extra_args or {}]

version = multi_arch_args_list[0].get("version", "") # the version is the same in multi-arch for each item
registry = f"{QUAY_REGISTRY_URL}/mongodb-enterprise-{image_name}" if not registry_address else registry_address
registry = f"{QUAY_REGISTRY_URL}/mongodb-kubernetes-{image_name}" if not registry_address else registry_address

for args in multi_arch_args_list: # in case we are building multiple architectures
args["quay_registry"] = registry
Expand Down Expand Up @@ -1412,7 +1417,7 @@ def get_builder_function_for_image_name() -> Dict[str, Callable]:
"init-ops-manager": build_init_om_image,
#
# Daily builds
"operator-daily": build_image_daily("operator"),
"operator-daily": build_image_daily("mongodb-kubernetes"),
"appdb-daily": build_image_daily("appdb"),
"database-daily": build_image_daily("database"),
"init-appdb-daily": build_image_daily("init-appdb"),
Expand Down
2 changes: 1 addition & 1 deletion release.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"ubi"
]
},
"operator": {
"mongodb-kubernetes": {
"Description": "We support 3 last versions, see https://wiki.corp.mongodb.com/display/MMS/Kubernetes+Operator+Support+Policy",
"ssdlc_name": "MongoDB Enterprise Kubernetes Operator",
"versions": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/evergreen/release/agent_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_supported_version_for_image_matrix_handling(


def get_supported_operator_versions(supported_versions: int = DEFAULT_SUPPORTED_OPERATOR_VERSIONS):
operator_versions = list(get_release()["supportedImages"]["operator"]["versions"])
operator_versions = list(get_release()["supportedImages"]["mongodb-kubernetes"]["versions"])
operator_versions.sort(key=lambda s: list(map(int, s.split("."))))

if len(operator_versions) <= supported_versions:
Expand Down
8 changes: 4 additions & 4 deletions scripts/evergreen/release/agent_matrix_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from scripts.evergreen.release.agent_matrix import get_supported_operator_versions

empty_release = {"supportedImages": {"operator": {"versions": []}}}
empty_release = {"supportedImages": {"mongodb-kubernetes": {"versions": []}}}


@mock.patch("scripts.evergreen.release.agent_matrix.get_release", return_value=empty_release)
Expand All @@ -11,7 +11,7 @@ def test_get_supported_operator_versions_empty(_):
assert len(supported_versions) == 0


single_release = {"supportedImages": {"operator": {"versions": ["1.30.0"]}}}
single_release = {"supportedImages": {"mongodb-kubernetes": {"versions": ["1.30.0"]}}}


@mock.patch("scripts.evergreen.release.agent_matrix.get_release", return_value=single_release)
Expand All @@ -21,7 +21,7 @@ def test_get_supported_operator_versions_single_release(_):
assert supported_versions[0] == "1.30.0"


three_releases_not_ordered = {"supportedImages": {"operator": {"versions": ["1.30.0", "1.28.0", "2.0.2"]}}}
three_releases_not_ordered = {"supportedImages": {"mongodb-kubernetes": {"versions": ["1.30.0", "1.28.0", "2.0.2"]}}}


@mock.patch("scripts.evergreen.release.agent_matrix.get_release", return_value=three_releases_not_ordered)
Expand All @@ -33,7 +33,7 @@ def test_get_supported_operator_versions_three_releases_not_ordered(_):

many_releases_not_ordered = {
"supportedImages": {
"operator": {
"mongodb-kubernetes": {
"versions": [
"1.32.0",
"1.25.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/evergreen/release/update_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def update_release_json():

# Trim init and operator images to keep only the latest 3 versions per major
trim_supported_image_versions(
data, ["operator", "init-ops-manager", "init-database", "init-appdb", "database", "ops-manager"]
data, ["mongodb-kubernetes", "init-ops-manager", "init-database", "init-appdb", "database", "ops-manager"]
)

# PCT already bumps the release.json, such that the last element contains the newest version, since they are sorted
Expand Down Expand Up @@ -137,7 +137,7 @@ def update_operator_related_versions(release: dict, version: str):
release[key] = version

keys_to_add_supported_versions = [
"operator",
"mongodb-kubernetes",
"init-ops-manager",
"init-database",
"init-appdb",
Expand Down