Skip to content

Commit 291f043

Browse files
authored
Merge branch 'master' into julienben/redesign-pipeline
2 parents 4ae4034 + 64ca2a8 commit 291f043

22 files changed

+864
-65
lines changed

build_info.json

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
{
2+
"images": {
3+
"mongodbOperator": {
4+
"patch": {
5+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes",
6+
"platforms": [
7+
"linux/amd64"
8+
]
9+
},
10+
"staging": {
11+
"repository": "quay.io/mongodb/mongodb-kubernetes-stg",
12+
"platforms": [
13+
"linux/arm64",
14+
"linux/amd64"
15+
]
16+
},
17+
"release": {
18+
"repository": "quay.io/mongodb/mongodb-kubernetes",
19+
"platforms": [
20+
"linux/arm64",
21+
"linux/amd64"
22+
]
23+
}
24+
},
25+
"initDatabase": {
26+
"patch": {
27+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-database",
28+
"platforms": [
29+
"linux/amd64"
30+
]
31+
},
32+
"staging": {
33+
"repository": "quay.io/mongodb/mongodb-kubernetes-init-database-stg",
34+
"platforms": [
35+
"linux/arm64",
36+
"linux/amd64"
37+
]
38+
},
39+
"release": {
40+
"repository": "quay.io/mongodb/mongodb-kubernetes-init-database",
41+
"platforms": [
42+
"linux/arm64",
43+
"linux/amd64"
44+
]
45+
}
46+
},
47+
"initAppDb": {
48+
"patch": {
49+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-appdb",
50+
"platforms": [
51+
"linux/amd64"
52+
]
53+
},
54+
"staging": {
55+
"repository": "quay.io/mongodb/mongodb-kubernetes-init-appdb-stg",
56+
"platforms": [
57+
"linux/arm64",
58+
"linux/amd64"
59+
]
60+
},
61+
"release": {
62+
"repository": "quay.io/mongodb/mongodb-kubernetes-init-appdb",
63+
"platforms": [
64+
"linux/arm64",
65+
"linux/amd64"
66+
]
67+
}
68+
},
69+
"initOpsManager": {
70+
"patch": {
71+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-init-ops-manager",
72+
"platforms": [
73+
"linux/amd64"
74+
]
75+
},
76+
"staging": {
77+
"repository": "quay.io/mongodb/mongodb-kubernetes-init-ops-manager-stg",
78+
"platforms": [
79+
"linux/arm64",
80+
"linux/amd64"
81+
]
82+
},
83+
"release": {
84+
"repository": "quay.io/mongodb/mongodb-kubernetes-init-ops-manager",
85+
"platforms": [
86+
"linux/arm64",
87+
"linux/amd64"
88+
]
89+
}
90+
},
91+
"database": {
92+
"patch": {
93+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-database",
94+
"platforms": [
95+
"linux/amd64"
96+
]
97+
},
98+
"staging": {
99+
"repository": "quay.io/mongodb/mongodb-kubernetes-database-stg",
100+
"platforms": [
101+
"linux/arm64",
102+
"linux/amd64"
103+
]
104+
},
105+
"release": {
106+
"repository": "quay.io/mongodb/mongodb-kubernetes-database",
107+
"platforms": [
108+
"linux/arm64",
109+
"linux/amd64"
110+
]
111+
}
112+
},
113+
"readinessprobe": {
114+
"patch": {
115+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-readinessprobe",
116+
"platforms": [
117+
"linux/amd64"
118+
]
119+
},
120+
"staging": {
121+
"repository": "quay.io/mongodb/mongodb-kubernetes-readinessprobe-stg",
122+
"platforms": [
123+
"linux/arm64",
124+
"linux/amd64"
125+
]
126+
},
127+
"release": {
128+
"version": "1.0.22",
129+
"repository": "quay.io/mongodb/mongodb-kubernetes-readinessprobe",
130+
"platforms": [
131+
"linux/arm64",
132+
"linux/amd64"
133+
]
134+
}
135+
},
136+
"operator-version-upgrade-post-start-hook": {
137+
"patch": {
138+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes-operator-version-upgrade-post-start-hook",
139+
"platforms": [
140+
"linux/amd64"
141+
]
142+
},
143+
"staging": {
144+
"repository": "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook-stg",
145+
"platforms": [
146+
"linux/arm64",
147+
"linux/amd64"
148+
]
149+
},
150+
"release": {
151+
"version": "1.0.9",
152+
"repository": "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook",
153+
"platforms": [
154+
"linux/arm64",
155+
"linux/amd64"
156+
]
157+
}
158+
}
159+
},
160+
"binaries": {
161+
"kubectl-mongodb": {
162+
"patch": {
163+
"s3-store": "s3://kubectl-mongodb/dev",
164+
"platforms": [
165+
"linux/amd64"
166+
]
167+
},
168+
"staging": {
169+
"s3-store": "s3://kubectl-mongodb/staging",
170+
"platforms": [
171+
"darwin/amd64",
172+
"darwin/arm64",
173+
"linux/amd64",
174+
"linux/arm64"
175+
]
176+
},
177+
"release": {
178+
"s3-store": "s3://kubectl-mongodb/prod",
179+
"platforms": [
180+
"darwin/amd64",
181+
"darwin/arm64",
182+
"linux/amd64",
183+
"linux/arm64"
184+
]
185+
}
186+
}
187+
},
188+
"helm-charts": {
189+
"mongodb-kubernetes": {
190+
"patch": {
191+
"repository": "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/helm-charts"
192+
},
193+
"staging": {
194+
"repository": "quay.io/mongodb/helm-charts-stg"
195+
},
196+
"release": {
197+
"repository": "quay.io/mongodb/helm-charts"
198+
}
199+
}
200+
}
201+
}

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/funcs/multicluster

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ prepare_multi_cluster_e2e_run() {
210210
fi
211211

212212
(
213-
cd public/tools/multicluster/
213+
cd cmd/kubectl-mongodb
214214
GOOS=darwin GOARCH="${goarch}" go build -o "${MULTI_CLUSTER_KUBE_CONFIG_CREATOR_PATH}" main.go
215215
)
216216
PATH=${PATH}:docker/mongodb-kubernetes-tests
217217
else
218218
(
219-
cd public/tools/multicluster/
219+
cd cmd/kubectl-mongodb
220220
# shellcheck disable=SC2030
221221
export PATH=${GOROOT}:${PATH}
222222
GOOS=linux GOARCH=amd64 go build -o "${MULTI_CLUSTER_KUBE_CONFIG_CREATOR_PATH}" main.go

scripts/release/build/__init__.py

Whitespace-only changes.

scripts/release/build/build_info.py

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import json
2+
from typing import Dict
3+
4+
from scripts.release.build.build_scenario import BuildScenario
5+
from scripts.release.constants import DEFAULT_REPOSITORY_PATH, DEFAULT_CHANGELOG_PATH, RELEASE_INITIAL_VERSION_ENV_VAR, \
6+
get_initial_version, get_initial_commit_sha
7+
8+
9+
class ImageInfo(dict):
10+
def __init__(self, repository: str, platforms: list[str], version: str):
11+
super().__init__()
12+
self.repository = repository
13+
self.platforms = platforms
14+
self.version = version
15+
16+
def to_json(self):
17+
return {"repository": self.repository, "platforms": self.platforms, "version": self.version}
18+
19+
20+
class BinaryInfo(dict):
21+
def __init__(self, s3_store: str, platforms: list[str], version: str):
22+
super().__init__()
23+
self.s3_store = s3_store
24+
self.platforms = platforms
25+
self.version = version
26+
27+
def to_json(self):
28+
return {"platforms": self.platforms, "version": self.version}
29+
30+
31+
class HelmChartInfo(dict):
32+
def __init__(self, repository: str, version: str):
33+
super().__init__()
34+
self.repository = repository
35+
self.version = version
36+
37+
def to_json(self):
38+
return {"repository": self.repository, "version": self.version}
39+
40+
41+
class BuildInfo(dict):
42+
def __init__(
43+
self, images: Dict[str, ImageInfo], binaries: Dict[str, BinaryInfo], helm_charts: Dict[str, HelmChartInfo]
44+
):
45+
super().__init__()
46+
self.images = images
47+
self.binaries = binaries
48+
self.helm_charts = helm_charts
49+
50+
def __dict__(self):
51+
return {
52+
"images": {name: images.__dict__ for name, images in self.images.items()},
53+
"binaries": {name: bin.__dict__ for name, bin in self.binaries.items()},
54+
"helm-charts": {name: chart.__dict__ for name, chart in self.helm_charts.items()},
55+
}
56+
57+
def to_json(self):
58+
return {
59+
"images": {name: images.to_json() for name, images in self.images.items()},
60+
"binaries": {name: bin.to_json() for name, bin in self.binaries.items()},
61+
"helm-charts": {name: chart.to_json() for name, chart in self.helm_charts.items()},
62+
}
63+
64+
65+
def load_build_info(scenario: BuildScenario,
66+
repository_path: str = DEFAULT_REPOSITORY_PATH,
67+
changelog_sub_path: str = DEFAULT_CHANGELOG_PATH,
68+
initial_commit_sha: str = None,
69+
initial_version: str = None) -> BuildInfo:
70+
f"""
71+
Load build information based on the specified scenario.
72+
73+
:param scenario: BuildScenario enum value indicating the build scenario (e.g., PATCH, STAGING, RELEASE).
74+
:param repository_path: Path to the Git repository. Default is the current directory `{DEFAULT_REPOSITORY_PATH}`.
75+
:param changelog_sub_path: Path to the changelog directory relative to the repository root. Default is '{DEFAULT_CHANGELOG_PATH}'.
76+
:param initial_commit_sha: SHA of the initial commit to start from if no previous version tag is found. If not provided, it will be determined based on `{RELEASE_INITIAL_VERSION_ENV_VAR} environment variable.
77+
:param initial_version: Initial version to use if no previous version tag is found. If not provided, it will be determined based on `{RELEASE_INITIAL_VERSION_ENV_VAR}` environment variable.
78+
:return: BuildInfo object containing images, binaries, and helm charts information for specified scenario.
79+
"""
80+
81+
if not initial_commit_sha:
82+
initial_commit_sha = get_initial_commit_sha()
83+
if not initial_version:
84+
initial_version = get_initial_version()
85+
86+
version = scenario.get_version(repository_path, changelog_sub_path, initial_commit_sha, initial_version)
87+
88+
with open("build_info.json", "r") as f:
89+
build_info = json.load(f)
90+
91+
images = {}
92+
for name, env_data in build_info["images"].items():
93+
data = env_data[scenario]
94+
# Only update the image_version if it is not already set in the build_info.json file
95+
image_version = data.get("version")
96+
if not image_version:
97+
image_version = version
98+
99+
images[name] = ImageInfo(repository=data["repository"], platforms=data["platforms"], version=image_version)
100+
101+
binaries = {}
102+
for name, env_data in build_info["binaries"].items():
103+
data = env_data[scenario]
104+
binaries[name] = BinaryInfo(s3_store=data["s3-store"], platforms=data["platforms"], version=version)
105+
106+
helm_charts = {}
107+
for name, env_data in build_info["helm-charts"].items():
108+
data = env_data[scenario]
109+
helm_charts[name] = HelmChartInfo(repository=data["repository"], version=version)
110+
111+
return BuildInfo(images=images, binaries=binaries, helm_charts=helm_charts)

0 commit comments

Comments
 (0)