Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit cc05f16

Browse files
authored
Fix ubuntu agent release (#887)
1 parent 6c3fb80 commit cc05f16

File tree

2 files changed

+48
-15
lines changed

2 files changed

+48
-15
lines changed

release.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"version": "11.0.11.7036-1",
77
"tools_version": "100.5.1"
88
}
9-
}
9+
}

scripts/ci/determine_required_releases.py

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,41 @@
1010
import requests
1111

1212
# contains a map of the quay urls to fetch data about the corresponding images.
13-
QUAY_URL_MAP = {
14-
"mongodb-agent": "https://quay.io/api/v1/repository/mongodb/mongodb-agent-ubi",
15-
"readiness-probe": "https://quay.io/api/v1/repository/mongodb/mongodb-kubernetes-readinessprobe",
16-
"version-upgrade-hook": "https://quay.io/api/v1/repository/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook",
17-
"mongodb-kubernetes-operator": "https://quay.io/api/v1/repository/mongodb/mongodb-kubernetes-operator",
13+
QUAY_URL_MAP: Dict[str, List[str]] = {
14+
"mongodb-agent": [
15+
"https://quay.io/api/v1/repository/mongodb/mongodb-agent-ubi",
16+
"https://quay.io/api/v1/repository/mongodb/mongodb-agent",
17+
],
18+
"readiness-probe": [
19+
"https://quay.io/api/v1/repository/mongodb/mongodb-kubernetes-readinessprobe",
20+
],
21+
"version-upgrade-hook": [
22+
"https://quay.io/api/v1/repository/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook"
23+
],
24+
"mongodb-kubernetes-operator": [
25+
"https://quay.io/api/v1/repository/mongodb/mongodb-kubernetes-operator"
26+
],
1827
}
1928

2029

21-
def _get_all_released_tags(image_type: str) -> List[str]:
22-
url = QUAY_URL_MAP[image_type]
30+
def _get_all_released_tags(url: str) -> List[str]:
2331
resp = requests.get(url).json()
2432
tags = resp["tags"]
2533
return list(tags.keys())
2634

2735

28-
def _load_image_name_to_version_map() -> Dict:
36+
def _load_image_name_to_version_map() -> Dict[str, str]:
37+
"""
38+
_load_image_name_to_version_map returns a mapping of each image name
39+
to the corresponding version.
40+
41+
e.g.
42+
{
43+
"mongodb-kubernetes-operator" : "0.7.2",
44+
"mongodb-agent" : "11.0.11.7036-1"
45+
...
46+
}
47+
"""
2948
with open("release.json") as f:
3049
release = json.loads(f.read())
3150

@@ -34,24 +53,38 @@ def _load_image_name_to_version_map() -> Dict:
3453
return release
3554

3655

56+
def _all_urls_are_released(urls: List[str], version: str) -> bool:
57+
"""
58+
_all_urls_are_released returns True if the given version exists
59+
as a tag in all urls provided.
60+
"""
61+
for url in urls:
62+
tags = _get_all_released_tags(url)
63+
if version not in tags:
64+
return False
65+
return True
66+
67+
3768
def main() -> int:
3869
if len(sys.argv) != 2:
3970
raise ValueError("usage: determine_required_releases.py [image-name]")
71+
4072
image_name = sys.argv[1]
41-
image_name_map = _load_image_name_to_version_map()
73+
name_to_version_map = _load_image_name_to_version_map()
4274

43-
if image_name not in image_name_map:
75+
if image_name not in name_to_version_map:
4476
raise ValueError(
4577
"Unknown image type [{}], valid values are [{}]".format(
46-
image_name, ",".join(image_name_map.keys())
78+
image_name, ",".join(name_to_version_map.keys())
4779
)
4880
)
4981

5082
if image_name not in QUAY_URL_MAP:
51-
raise ValueError("No associated image url with key [{}]".format(image_name))
83+
raise ValueError("No associated image urls for key [{}]".format(image_name))
5284

53-
tags = _get_all_released_tags(image_name)
54-
if image_name_map[image_name] in tags:
85+
if _all_urls_are_released(
86+
QUAY_URL_MAP[image_name], name_to_version_map[image_name]
87+
):
5588
print("released")
5689
else:
5790
print("unreleased")

0 commit comments

Comments
 (0)