Skip to content

Commit 01de91c

Browse files
committed
Review fixes
1 parent 0994d18 commit 01de91c

File tree

12 files changed

+363
-352
lines changed

12 files changed

+363
-352
lines changed

build_info.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"images": {
33
"mongodbOperator": {
4-
"dev": {
4+
"patch": {
55
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes",
66
"platforms": [
77
"linux/amd64"
@@ -14,7 +14,7 @@
1414
"linux/amd64"
1515
]
1616
},
17-
"prod": {
17+
"release": {
1818
"repository": "quay.io/mongodb/mongodb-kubernetes",
1919
"platforms": [
2020
"linux/arm64",
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"initDatabase": {
26-
"dev": {
26+
"patch": {
2727
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-database",
2828
"platforms": [
2929
"linux/amd64"
@@ -36,7 +36,7 @@
3636
"linux/amd64"
3737
]
3838
},
39-
"prod": {
39+
"release": {
4040
"repository": "quay.io/mongodb/mongodb-kubernetes-init-database",
4141
"platforms": [
4242
"linux/arm64",
@@ -45,7 +45,7 @@
4545
}
4646
},
4747
"initAppDb": {
48-
"dev": {
48+
"patch": {
4949
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-appdb",
5050
"platforms": [
5151
"linux/amd64"
@@ -58,7 +58,7 @@
5858
"linux/amd64"
5959
]
6060
},
61-
"prod": {
61+
"release": {
6262
"repository": "quay.io/mongodb/mongodb-kubernetes-init-appdb",
6363
"platforms": [
6464
"linux/arm64",
@@ -67,7 +67,7 @@
6767
}
6868
},
6969
"initOpsManager": {
70-
"dev": {
70+
"patch": {
7171
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-ops-manager",
7272
"platforms": [
7373
"linux/amd64"
@@ -80,7 +80,7 @@
8080
"linux/amd64"
8181
]
8282
},
83-
"prod": {
83+
"release": {
8484
"repository": "quay.io/mongodb/mongodb-kubernetes-init-ops-manager",
8585
"platforms": [
8686
"linux/arm64",
@@ -89,7 +89,7 @@
8989
}
9090
},
9191
"database": {
92-
"dev": {
92+
"patch": {
9393
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-database",
9494
"platforms": [
9595
"linux/amd64"
@@ -102,7 +102,7 @@
102102
"linux/amd64"
103103
]
104104
},
105-
"prod": {
105+
"release": {
106106
"repository": "quay.io/mongodb/mongodb-kubernetes-database",
107107
"platforms": [
108108
"linux/arm64",
@@ -111,7 +111,7 @@
111111
}
112112
},
113113
"readinessprobe": {
114-
"dev": {
114+
"patch": {
115115
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-readinessprobe",
116116
"platforms": [
117117
"linux/amd64"
@@ -124,7 +124,7 @@
124124
"linux/amd64"
125125
]
126126
},
127-
"prod": {
127+
"release": {
128128
"version": "1.0.22",
129129
"repository": "quay.io/mongodb/mongodb-kubernetes-readinessprobe",
130130
"platforms": [
@@ -134,7 +134,7 @@
134134
}
135135
},
136136
"operator-version-upgrade-post-start-hook": {
137-
"dev": {
137+
"patch": {
138138
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-operator-version-upgrade-post-start-hook",
139139
"platforms": [
140140
"linux/amd64"
@@ -147,7 +147,7 @@
147147
"linux/amd64"
148148
]
149149
},
150-
"prod": {
150+
"release": {
151151
"version": "1.0.9",
152152
"repository": "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook",
153153
"platforms": [
@@ -159,7 +159,7 @@
159159
},
160160
"binaries": {
161161
"kubectl-mongodb": {
162-
"dev": {
162+
"patch": {
163163
"s3-store": "s3://kubectl-mongodb/dev",
164164
"platforms": [
165165
"linux/amd64"
@@ -174,7 +174,7 @@
174174
"linux/arm64"
175175
]
176176
},
177-
"prod": {
177+
"release": {
178178
"s3-store": "s3://kubectl-mongodb/prod",
179179
"platforms": [
180180
"darwin/amd64",
@@ -187,13 +187,13 @@
187187
},
188188
"helm-charts": {
189189
"mongodb-kubernetes": {
190-
"dev": {
190+
"patch": {
191191
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/helm-charts"
192192
},
193193
"staging": {
194194
"repository": "quay.io/mongodb/helm-charts-stg"
195195
},
196-
"prod": {
196+
"release": {
197197
"repository": "quay.io/mongodb/helm-charts"
198198
}
199199
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.black]
22
line-length = 120
3-
target-version = ['py39']
3+
target-version = ['py313']
44
include = '\.pyi?$'
55

66
[tool.isort]

scripts/release/build/__init__.py

Whitespace-only changes.

scripts/release/build/build_info.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import json
2+
from typing import Dict
3+
4+
from scripts.release.build.build_scenario import BuildScenario
5+
6+
7+
class ImageInfo(dict):
8+
def __init__(self, repository: str, platforms: list[str], version: str):
9+
super().__init__()
10+
self.repository = repository
11+
self.platforms = platforms
12+
self.version = version
13+
14+
def to_json(self):
15+
return {"repository": self.repository, "platforms": self.platforms, "version": self.version}
16+
17+
18+
class BinaryInfo(dict):
19+
def __init__(self, s3_store: str, platforms: list[str], version: str):
20+
super().__init__()
21+
self.s3_store = s3_store
22+
self.platforms = platforms
23+
self.version = version
24+
25+
def to_json(self):
26+
return {"platforms": self.platforms, "version": self.version}
27+
28+
29+
class HelmChartInfo(dict):
30+
def __init__(self, repository: str, version: str):
31+
super().__init__()
32+
self.repository = repository
33+
self.version = version
34+
35+
def to_json(self):
36+
return {"repository": self.repository, "version": self.version}
37+
38+
39+
class BuildInfo(dict):
40+
def __init__(
41+
self, images: Dict[str, ImageInfo], binaries: Dict[str, BinaryInfo], helm_charts: Dict[str, HelmChartInfo]
42+
):
43+
super().__init__()
44+
self.images = images
45+
self.binaries = binaries
46+
self.helm_charts = helm_charts
47+
48+
def __dict__(self):
49+
return {
50+
"images": {name: images.__dict__ for name, images in self.images.items()},
51+
"binaries": {name: bin.__dict__ for name, bin in self.binaries.items()},
52+
"helm-charts": {name: chart.__dict__ for name, chart in self.helm_charts.items()},
53+
}
54+
55+
def to_json(self):
56+
return {
57+
"images": {name: images.to_json() for name, images in self.images.items()},
58+
"binaries": {name: bin.to_json() for name, bin in self.binaries.items()},
59+
"helm-charts": {name: chart.to_json() for name, chart in self.helm_charts.items()},
60+
}
61+
62+
63+
def load_build_info(scenario: BuildScenario, version: str) -> BuildInfo:
64+
with open("build_info.json", "r") as f:
65+
build_info = json.load(f)
66+
67+
images = {}
68+
for name, env_data in build_info["images"].items():
69+
data = env_data[scenario]
70+
# Only update the image_version if it is not already set in the build_info.json file
71+
image_version = data.get("version")
72+
if not image_version:
73+
image_version = version
74+
75+
images[name] = ImageInfo(repository=data["repository"], platforms=data["platforms"], version=image_version)
76+
77+
binaries = {}
78+
for name, env_data in build_info["binaries"].items():
79+
data = env_data[scenario]
80+
binaries[name] = BinaryInfo(s3_store=data["s3-store"], platforms=data["platforms"], version=version)
81+
82+
helm_charts = {}
83+
for name, env_data in build_info["helm-charts"].items():
84+
data = env_data[scenario]
85+
helm_charts[name] = HelmChartInfo(repository=data["repository"], version=version)
86+
87+
return BuildInfo(images=images, binaries=binaries, helm_charts=helm_charts)

0 commit comments

Comments
 (0)