Skip to content

Commit 56a8d85

Browse files
authored
CLOUDP-83092: Add init container images to inventory file (#432)
1 parent 8f99457 commit 56a8d85

File tree

5 files changed

+81
-45
lines changed

5 files changed

+81
-45
lines changed

.evergreen.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,20 @@ tasks:
217217
commands:
218218
- func: clone
219219
- func: setup_virtualenv
220-
- func: build_and_push_image
220+
- func: build_and_push_image_sonar
221221
vars:
222-
image: quay.io/mongodb/community-operator-version-upgrade-post-start-hook:${version_id}
223-
image_type: versionhook
224-
expire_after: 48h
222+
image_name: version-post-start-hook-init
223+
224+
- name: build_readiness_probe_image
225+
priority: 60
226+
exec_timeout_secs: 600
227+
commands:
228+
- func: clone
229+
- func: setup_virtualenv
230+
- func: build_and_push_image_sonar
231+
vars:
232+
image_name: readiness-probe-init
233+
225234

226235
- name: e2e_test_feature_compatibility_version
227236
commands:
@@ -361,6 +370,8 @@ buildvariants:
361370
variant: init_test_run
362371
- name: build_prehook_image
363372
variant: init_test_run
373+
- name: build_readiness_probe_image
374+
variant: init_test_run
364375
- name: build_agent_image_ubuntu
365376
variant: init_test_run
366377
tasks:
@@ -379,6 +390,8 @@ buildvariants:
379390
variant: init_test_run
380391
- name: build_prehook_image
381392
variant: init_test_run
393+
- name: build_readiness_probe_image
394+
variant: init_test_run
382395
- name: build_agent_image_ubi
383396
variant: init_test_run
384397
tasks:
@@ -394,6 +407,7 @@ buildvariants:
394407
- name: build_prehook_image
395408
- name: build_agent_image_ubi
396409
- name: build_agent_image_ubuntu
410+
- name: build_readiness_probe_image
397411

398412
- name: release_blocker
399413
display_name: release_blocker

inventory.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,36 @@ images:
6363
output:
6464
- registry: $(inputs.params.registry)/mongodb-agent-ubi-dev
6565
tag: $(inputs.params.version_id)
66+
67+
68+
- name: readiness-probe-init
69+
vars:
70+
context: .
71+
72+
stages:
73+
- name: readiness-probe-init-build
74+
task_type: docker_build
75+
dockerfile: scripts/dev/dockerfiles/Dockerfile.readiness
76+
77+
labels:
78+
quay.expires-after: 48h
79+
80+
output:
81+
- registry: $(inputs.params.registry)/mongodb-kubernetes-readinessprobe-dev
82+
tag: $(inputs.params.version_id)
83+
84+
- name: version-post-start-hook-init
85+
vars:
86+
context: .
87+
88+
stages:
89+
- name: version-post-start-hook-init-build
90+
task_type: docker_build
91+
dockerfile: scripts/dev/dockerfiles/Dockerfile.versionhook
92+
93+
labels:
94+
quay.expires-after: 48h
95+
96+
output:
97+
- registry: $(inputs.params.registry)/mongodb-kubernetes-operator-version-upgrade-post-start-hook-dev
98+
tag: $(inputs.params.version_id)

pipeline.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
from scripts.dev.dev_config import load_config, DevConfig
99

10-
VALID_IMAGE_NAMES = frozenset(["agent-ubi", "agent-ubuntu"])
10+
VALID_IMAGE_NAMES = frozenset(
11+
[
12+
"agent-ubi",
13+
"agent-ubuntu",
14+
"readiness-probe-init",
15+
"version-post-start-hook-init",
16+
]
17+
)
1118

1219
DEFAULT_IMAGE_TYPE = "ubuntu"
1320
DEFAULT_NAMESPACE = "default"
@@ -47,6 +54,24 @@ def build_agent_image_ubuntu(config: DevConfig) -> None:
4754
)
4855

4956

57+
def build_readiness_probe_image(config: DevConfig) -> None:
58+
sonar_build_image(
59+
"readiness-probe-init",
60+
args={
61+
"registry": config.repo_url,
62+
},
63+
)
64+
65+
66+
def build_version_post_start_hook_image(config: DevConfig) -> None:
67+
sonar_build_image(
68+
"version-post-start-hook-init",
69+
args={
70+
"registry": config.repo_url,
71+
},
72+
)
73+
74+
5075
def sonar_build_image(
5176
image_name: str,
5277
args: Optional[Dict[str, str]] = None,
@@ -78,12 +103,14 @@ def main() -> int:
78103
)
79104
return 1
80105

81-
agent_build_function = {
106+
image_build_function = {
82107
"agent-ubi": build_agent_image_ubi,
83108
"agent-ubuntu": build_agent_image_ubuntu,
109+
"readiness-probe-init": build_readiness_probe_image,
110+
"version-post-start-hook-init": build_version_post_start_hook_image,
84111
}[image_name]
85112

86-
agent_build_function(load_config())
113+
image_build_function(load_config())
87114
return 0
88115

89116

scripts/dev/dockerfile_generator.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,6 @@
1111
GOLANG_TAG = "1.14"
1212

1313

14-
def _shared_agent_params() -> DockerParameters:
15-
with open("release.json", "r") as f:
16-
release = json.loads(f.read())
17-
18-
return {
19-
"template_path": "scripts/dev/templates/agent",
20-
"agent_version": release["agent"]["version"],
21-
"tools_version": release["agent"]["tools_version"],
22-
}
23-
24-
25-
def agent_ubuntu_params() -> DockerParameters:
26-
params = _shared_agent_params()
27-
params.update(
28-
{
29-
"base_image": "ubuntu:16.04",
30-
"tools_distro": "ubuntu1604-x86_64",
31-
"agent_distro": "linux_x86_64",
32-
}
33-
)
34-
return params
35-
36-
37-
def agent_ubi_params() -> DockerParameters:
38-
params = _shared_agent_params()
39-
params.update(
40-
{
41-
"base_image": "registry.access.redhat.com/ubi7/ubi",
42-
"tools_distro": "rhel70-x86_64",
43-
"agent_distro": "rhel7_x86_64",
44-
}
45-
)
46-
return params
47-
48-
4914
def operator_params(files_to_add: List[str]) -> DockerParameters:
5015
return {
5116
"builder": True,
@@ -67,8 +32,6 @@ def render(image_name: str, files_to_add: List[str]) -> str:
6732
param_dict = {
6833
"e2e": e2e_params(files_to_add),
6934
"operator": operator_params(files_to_add),
70-
"agent_ubi": agent_ubi_params(),
71-
"agent_ubuntu": agent_ubuntu_params(),
7235
}
7336

7437
render_values = param_dict.get(image_name, dict())

scripts/dev/templates/Dockerfile.versionhook renamed to scripts/dev/dockerfiles/Dockerfile.versionhook

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# TODO: template this
21
FROM golang AS builder
32

43
ENV GO111MODULE=on

0 commit comments

Comments
 (0)