Skip to content

Commit c97c7a0

Browse files
[CLOUDP-361632] Add information about latest OM and agent in release.json (#622)
# Summary We have been getting some request from the customers where they wanted to know the combination of the container images that they require to run a specific version of operator and Mongo DB instance. As part of that work we are going to add a new file (release_info.json) as the assets in the GitHub release. That file is going to have details about the latest released images. These images are going to be the images that MCK publishes as well as the latest OM and Agent version mappings. To enable that, as part of this PR we are adding a new field in the `release.json` that has the mapping between OM version and agent version of latest OM releases. This new field in the `release.json` is going to have the opsManaget to agent image version mapping for every major opsmanager version. We are adding this information in the `release.json` so that it can easily be used later (in next PR), to create the release_info.json file. This PR also updated the precommit hook so that when new version of OM is released, the newly added field of release.json would properly be updated with newly release OM/agent. ## Proof of Work Manual: - Mimic new release of OM by adding a new version (8.0.17) to `supportedImages.ops-manager.versions` and respective entry in `mongodb-agent.opsManagerMapping`. Run `make precommit` and verify that the `supportedImages.latestOpsManagerAgentMapping` has been updated for major version 8 with updated versions. - Mimic the new major version release of OM by adding new version (9.0.1) to `supportedImages.ops-manager.versions` and respective entry in `mongodb-agent.opsManagerMapping`. Run `make precommit` and verify that a new entry for major version 9 has been added to `supportedImages.latestOpsManagerAgentMapping`. ## Checklist - [x] Have you linked a jira ticket and/or is the ticket in the title? - [x] Have you checked whether your jira ticket required DOCSP changes? - [ ] Have you added changelog file? (will show up later) - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details
1 parent 3b35a2c commit c97c7a0

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

release.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@
1616
"search": {
1717
"version": "0.55.0"
1818
},
19+
"latestOpsManagerAgentMapping": [
20+
{
21+
"6": {
22+
"opsManagerVersion": "6.0.27",
23+
"agentVersion": "12.0.35.7911-1"
24+
}
25+
},
26+
{
27+
"7": {
28+
"opsManagerVersion": "7.0.19",
29+
"agentVersion": "107.0.19.8805-1"
30+
}
31+
},
32+
{
33+
"8": {
34+
"opsManagerVersion": "8.0.16",
35+
"agentVersion": "108.0.16.8895-1"
36+
}
37+
}
38+
],
1939
"supportedImages": {
2040
"ops-manager": {
2141
"ssdlc_name": "MongoDB Controllers for Kubernetes Enterprise Ops Manager",

scripts/evergreen/release/update_release.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ def update_release_json():
3131
newest_operator_version = data["mongodbOperator"]
3232
update_operator_related_versions(data, newest_operator_version)
3333

34+
# Adds mapping between latest major version of OM and agent to the release.json
35+
update_latest_om_agent_mapping(data, newest_om_version)
36+
3437
with open(release, "w") as f:
3538
json.dump(
3639
data,
@@ -40,6 +43,52 @@ def update_release_json():
4043
f.write("\n")
4144

4245

46+
def update_latest_om_agent_mapping(data, new_om_version):
47+
"""
48+
Updates the 'latestOpsManagerAgentMapping' in release.json with
49+
newly released Ops Manager version and its corresponding Agent version.
50+
51+
If a OM's major version entry already exists, it updates the 'opsManagerVersion'
52+
for that entry. Otherwise, it adds a new entry for the major version.
53+
54+
Args:
55+
data (dict): The complete configuration dictionary.
56+
new_om_version (str): The new Ops Manager version (e.g., "8.0.11").
57+
"""
58+
59+
try:
60+
om_agent_mapping = data["latestOpsManagerAgentMapping"]
61+
except KeyError:
62+
logger.error("Error: 'latestOpsManagerAgentMapping' field not found in the release.json data.")
63+
64+
new_agent_version = data["supportedImages"]["mongodb-agent"]["opsManagerMapping"]["ops_manager"][new_om_version][
65+
"agent_version"
66+
]
67+
68+
try:
69+
new_om_major_version = new_om_version.split(".")[0]
70+
except IndexError:
71+
logger.error(f"Error: Invalid version format for new_om_version: {new_om_version}")
72+
73+
new_om_agent_mapping = {"opsManagerVersion": new_om_version, "agentVersion": new_agent_version}
74+
75+
new_entry = {new_om_major_version: new_om_agent_mapping}
76+
77+
major_version_found = False
78+
for mapping in om_agent_mapping:
79+
if new_om_major_version in mapping:
80+
# Update the existing entry
81+
mapping[new_om_major_version] = new_om_agent_mapping
82+
major_version_found = True
83+
logger.info(f"Updated existing entry for major version '{new_om_major_version}' to {new_om_version}.")
84+
break
85+
86+
# this is new major version of OM, a new entry will be added
87+
if not major_version_found:
88+
om_agent_mapping.append(new_entry)
89+
logger.info(f"Added new entry for major version '{new_om_major_version}' with version {new_om_version}.")
90+
91+
4392
def update_operator_related_versions(release: dict, version: str):
4493
"""
4594
Updates version on `source`, that corresponds to `release.json`.

0 commit comments

Comments
 (0)