Skip to content

Commit 1bf5f80

Browse files
authored
Cloudp 83092 upload dockerfiles to s3 (#436)
1 parent 36d1c69 commit 1bf5f80

File tree

4 files changed

+63
-25
lines changed

4 files changed

+63
-25
lines changed

.evergreen.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ functions:
115115
params:
116116
env:
117117
MONGODB_COMMUNITY_CONFIG: ${workdir}/mongodb-kubernetes-operator/scripts/ci/config.json
118+
AWS_ACCESS_KEY_ID: ${community_aws_access_key_id}
119+
AWS_SECRET_ACCESS_KEY: ${community_aws_secret_access_key}
118120
include_expansions_in_env:
119121
- version_id
120122
- quay_user_name

inventory.yaml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
vars:
22
registry: <registry>
3+
s3_bucket_http: https://enterprise-operator-dockerfiles.s3.amazonaws.com/dockerfiles/mongodb-agent
4+
s3_bucket: s3://enterprise-operator-dockerfiles/dockerfiles/mongodb-agent
35

46
images:
57
- name: agent-ubuntu
@@ -31,11 +33,6 @@ images:
3133
tags: ["ubuntu"]
3234
distro: ubuntu
3335

34-
# TODO: remove - this is only here as sonar raises a key error on version_id
35-
# if no other inputs are specified.
36-
inputs:
37-
- noop
38-
3936
output:
4037
- dockerfile: scripts/dev/templates/agent/Dockerfile.ubuntu-$(inputs.params.version_id)
4138

@@ -55,6 +52,29 @@ images:
5552
- registry: $(inputs.params.registry)/mongodb-agent-ubuntu-dev
5653
tag: $(inputs.params.version_id)
5754

55+
- name: agent-template-ubuntu-s3
56+
task_type: dockerfile_template
57+
tags: ["ubuntu", "release"]
58+
distro: ubuntu
59+
60+
inputs:
61+
- release_version
62+
63+
output:
64+
- dockerfile: $(inputs.params.s3_bucket)/Dockerfile.ubuntu-$(inputs.params.release_version)
65+
66+
- name: agent-context-ubuntu-release
67+
task_type: tag_image
68+
tags: ["ubuntu", "release"]
69+
distro: ubuntu
70+
71+
source:
72+
registry: $(inputs.params.registry)/agent-ubuntu-context-dev
73+
tag: $(inputs.params.version_id)
74+
75+
destination:
76+
- registry: $(inputs.params.registry)/mongodb-agent-ubuntu-context
77+
tag: $(inputs.params.release_version)-context
5878

5979
- name: agent-ubi
6080
vars:
@@ -86,11 +106,6 @@ images:
86106
distro: ubi
87107
tags: ["ubi"]
88108

89-
# TODO: remove - this is only here as sonar raises a key error on version_id
90-
# if no other inputs are specified.
91-
inputs:
92-
- noop
93-
94109
output:
95110
- dockerfile: scripts/dev/templates/agent/Dockerfile.ubi-$(inputs.params.version_id)
96111

@@ -110,6 +125,29 @@ images:
110125
- registry: $(inputs.params.registry)/mongodb-agent-ubi-dev
111126
tag: $(inputs.params.version_id)
112127

128+
- name: agent-template-ubi-s3
129+
task_type: dockerfile_template
130+
tags: ["ubi", "release"]
131+
distro: ubi
132+
133+
inputs:
134+
- release_version
135+
136+
output:
137+
- dockerfile: $(inputs.params.s3_bucket)/Dockerfile.ubi-$(inputs.params.release_version)
138+
139+
- name: agent-context-ubi-release
140+
task_type: tag_image
141+
tags: ["ubi", "release"]
142+
distro: ubi
143+
144+
source:
145+
registry: $(inputs.params.registry)/agent-ubi-context-dev
146+
tag: $(inputs.params.version_id)
147+
148+
destination:
149+
- registry: $(inputs.params.registry)/mongodb-agent-ubi-context
150+
tag: $(inputs.params.release_version)-context
113151

114152
- name: readiness-probe-init
115153
vars:

pipeline.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,24 @@
2020
DEFAULT_NAMESPACE = "default"
2121

2222

23-
def build_agent_image_ubi(config: DevConfig) -> None:
24-
image_name = "agent-ubi"
23+
def _load_release() -> Dict:
2524
with open("release.json") as f:
2625
release = json.loads(f.read())
26+
return release
2727

28-
args = {
28+
29+
def _build_agent_args(config: DevConfig) -> Dict[str, str]:
30+
release = _load_release()
31+
return {
2932
"agent_version": release["agent"]["version"],
3033
"tools_version": release["agent"]["tools_version"],
3134
"registry": config.repo_url,
3235
}
3336

37+
38+
def build_agent_image_ubi(config: DevConfig) -> None:
39+
image_name = "agent-ubi"
40+
args = _build_agent_args(config)
3441
config.ensure_tag_is_run("ubi")
3542

3643
sonar_build_image(
@@ -42,14 +49,7 @@ def build_agent_image_ubi(config: DevConfig) -> None:
4249

4350
def build_agent_image_ubuntu(config: DevConfig) -> None:
4451
image_name = "agent-ubuntu"
45-
with open("release.json") as f:
46-
release = json.loads(f.read())
47-
args = {
48-
"agent_version": release["agent"]["version"],
49-
"tools_version": release["agent"]["tools_version"],
50-
"registry": config.repo_url,
51-
}
52-
52+
args = _build_agent_args(config)
5353
config.ensure_tag_is_run("ubuntu")
5454

5555
sonar_build_image(
@@ -60,9 +60,7 @@ def build_agent_image_ubuntu(config: DevConfig) -> None:
6060

6161

6262
def build_readiness_probe_image(config: DevConfig) -> None:
63-
with open("release.json") as f:
64-
release = json.loads(f.read())
65-
63+
release = _load_release()
6664
config.ensure_tag_is_run("readiness-probe")
6765

6866
sonar_build_image(

scripts/ci/setup_virtualenv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ virtualenv --python /opt/python/3.7/bin/python3 ./venv
77
pip3 install -r ./requirements.txt
88

99
# shellcheck disable=SC2154
10-
pip3 install "git+https://${sonar_github_token}@github.com/10gen/sonar.git@0.0.9"
10+
pip3 install "git+https://${sonar_github_token}@github.com/10gen/sonar.git@0.0.10"

0 commit comments

Comments
 (0)