Skip to content

Commit 7566a39

Browse files
authored
add dockerimages and fix release script (#228)
1 parent 3b5124b commit 7566a39

File tree

31 files changed

+1943
-8
lines changed

31 files changed

+1943
-8
lines changed

.evergreen.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ tasks:
286286
- func: pipeline
287287
vars:
288288
image_name: operator
289+
include_tags: release
289290

290291
# Releases init images to Quay
291292
- name: release_init_appdb
@@ -299,6 +300,7 @@ tasks:
299300
- func: pipeline
300301
vars:
301302
image_name: init-appdb
303+
include_tags: release
302304

303305
- name: release_init_database
304306
tags: [ "image_release" ]
@@ -311,6 +313,7 @@ tasks:
311313
- func: pipeline
312314
vars:
313315
image_name: init-database
316+
include_tags: release
314317

315318
- name: release_init_ops_manager
316319
tags: [ "image_release" ]
@@ -323,6 +326,7 @@ tasks:
323326
- func: pipeline
324327
vars:
325328
image_name: init-ops-manager
329+
include_tags: release
326330

327331
- name: release_agent_operator_release
328332
tags: [ "image_release" ]
@@ -335,6 +339,7 @@ tasks:
335339
- func: pipeline
336340
vars:
337341
image_name: agent
342+
include_tags: release
338343

339344
# pct only triggers this variant once a new agent image is out
340345
- name: release_agent

pipeline.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,19 @@ def get_release() -> Dict:
263263
return json.load(release)
264264

265265

266-
def get_git_release_tag() -> tuple[str, bool]:
266+
def get_git_release_tag() -> str:
267267
"""Returns the git tag of the current run on releases, on non-release returns the patch id."""
268268
release_env_var = os.getenv("triggered_by_git_tag")
269269

270270
# that means we are in a release and only return the git_tag; otherwise we want to return the patch_id
271271
# appended to ensure the image created is unique and does not interfere
272272
if release_env_var is not None:
273-
return release_env_var, True
273+
logger.info(f"git tag detected: {release_env_var}")
274+
return release_env_var
274275

275276
patch_id = os.environ.get("version_id", "latest")
276-
return patch_id, False
277+
logger.info(f"No git tag detected, using patch_id: {patch_id}")
278+
return patch_id
277279

278280

279281
def copy_into_container(client, src, dst):
@@ -492,7 +494,7 @@ def build_operator_image(build_configuration: BuildConfiguration):
492494
# repository with a given suffix.
493495
test_suffix = os.environ.get("test_suffix", "")
494496
log_automation_config_diff = os.environ.get("LOG_AUTOMATION_CONFIG_DIFF", "false")
495-
version, is_release = get_git_release_tag()
497+
version = get_git_release_tag()
496498

497499
# Use only amd64 if we should skip arm64 builds
498500
if should_skip_arm64(build_configuration):
@@ -522,7 +524,7 @@ def build_operator_image(build_configuration: BuildConfiguration):
522524
current_span.set_attribute("mck.architecture", architectures)
523525

524526
ecr_registry = os.environ.get("BASE_REPO_URL", "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev")
525-
base_repo = QUAY_REGISTRY_URL if is_release else ecr_registry
527+
base_repo = QUAY_REGISTRY_URL if build_configuration.is_release_step_executed() else ecr_registry
526528

527529
build_image_generic(
528530
config=build_configuration,
@@ -1101,7 +1103,7 @@ def build_community_image(build_configuration: BuildConfiguration, image_type: s
11011103
else:
11021104
raise ValueError(f"Unsupported image type: {image_type}")
11031105

1104-
version, is_release = get_git_release_tag()
1106+
version = get_git_release_tag()
11051107
golang_version = os.getenv("GOLANG_VERSION", "1.24")
11061108

11071109
# Use only amd64 if we should skip arm64 builds
@@ -1122,7 +1124,7 @@ def build_community_image(build_configuration: BuildConfiguration, image_type: s
11221124
multi_arch_args_list.append(arch_args)
11231125

11241126
ecr_registry = os.environ.get("BASE_REPO_URL", "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev")
1125-
base_repo = QUAY_REGISTRY_URL if is_release else ecr_registry
1127+
base_repo = QUAY_REGISTRY_URL if build_configuration.is_release_step_executed() else ecr_registry
11261128

11271129
build_image_generic(
11281130
config=build_configuration,
@@ -1242,7 +1244,8 @@ def build_agent_default_case(build_configuration: BuildConfiguration):
12421244
"""
12431245
release = get_release()
12441246

1245-
operator_version, is_release = get_git_release_tag()
1247+
operator_version = get_git_release_tag()
1248+
is_release = build_configuration.is_release_step_executed()
12461249

12471250
# We need to release [all agents x latest operator] on operator releases
12481251
if is_release:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
ARG imagebase
2+
FROM ${imagebase} as base
3+
4+
FROM registry.access.redhat.com/ubi9/ubi-minimal
5+
6+
ARG version
7+
8+
LABEL name="MongoDB Agent" \
9+
version="${version}" \
10+
summary="MongoDB Agent" \
11+
description="MongoDB Agent" \
12+
vendor="MongoDB" \
13+
release="1" \
14+
maintainer="[email protected]"
15+
16+
# Replace libcurl-minimal and curl-minimal with the full versions
17+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
18+
RUN microdnf install -y libssh libpsl libbrotli \
19+
&& microdnf download curl libcurl \
20+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
21+
&& microdnf remove -y libcurl-minimal curl-minimal
22+
23+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
24+
# Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
25+
RUN microdnf install -y --disableplugin=subscription-manager \
26+
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
27+
# Dependencies for the Agent
28+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
29+
net-snmp \
30+
net-snmp-agent-libs
31+
RUN microdnf install -y --disableplugin=subscription-manager \
32+
hostname tar gzip procps jq \
33+
&& microdnf upgrade -y \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
RUN mkdir -p /agent \
37+
&& mkdir -p /var/lib/mongodb-mms-automation \
38+
&& mkdir -p /var/log/mongodb-mms-automation/ \
39+
&& chmod -R +wr /var/log/mongodb-mms-automation/ \
40+
# ensure that the agent user can write the logs in OpenShift
41+
&& touch /var/log/mongodb-mms-automation/readiness.log \
42+
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
43+
44+
45+
COPY --from=base /data/mongodb-agent.tar.gz /agent
46+
COPY --from=base /data/mongodb-tools.tgz /agent
47+
COPY --from=base /data/LICENSE /licenses/LICENSE
48+
49+
RUN tar xfz /agent/mongodb-agent.tar.gz \
50+
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
51+
&& chmod +x /agent/mongodb-agent \
52+
&& mkdir -p /var/lib/automation/config \
53+
&& chmod -R +r /var/lib/automation/config \
54+
&& rm /agent/mongodb-agent.tar.gz \
55+
&& rm -r mongodb-mms-automation-agent-*
56+
57+
RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
58+
59+
USER 2000
60+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
ARG imagebase
2+
FROM ${imagebase} as base
3+
4+
FROM registry.access.redhat.com/ubi9/ubi-minimal
5+
6+
ARG version
7+
8+
LABEL name="MongoDB Agent" \
9+
version="${version}" \
10+
summary="MongoDB Agent" \
11+
description="MongoDB Agent" \
12+
vendor="MongoDB" \
13+
release="1" \
14+
maintainer="[email protected]"
15+
16+
COPY --from=base /data/probe.sh /opt/scripts/probe.sh
17+
COPY --from=base /data/readinessprobe /opt/scripts/readinessprobe
18+
COPY --from=base /data/version-upgrade-hook /opt/scripts/version-upgrade-hook
19+
COPY --from=base /data/agent-launcher-lib.sh /opt/scripts/agent-launcher-lib.sh
20+
COPY --from=base /data/agent-launcher.sh /opt/scripts/agent-launcher.sh
21+
COPY --from=base /data/LICENSE /licenses/LICENSE
22+
23+
# Replace libcurl-minimal and curl-minimal with the full versions
24+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
25+
RUN microdnf install -y libssh libpsl libbrotli \
26+
&& microdnf download curl libcurl \
27+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
28+
&& microdnf remove -y libcurl-minimal curl-minimal
29+
30+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
31+
# Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
32+
RUN microdnf install -y --disableplugin=subscription-manager \
33+
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
34+
# Dependencies for the Agent
35+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
36+
net-snmp \
37+
net-snmp-agent-libs
38+
RUN microdnf install -y --disableplugin=subscription-manager \
39+
hostname tar gzip procps jq \
40+
&& microdnf upgrade -y \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
44+
COPY --from=base /data/mongodb_tools_ubi.tgz /tools/mongodb_tools.tgz
45+
COPY --from=base /data/mongodb_agent_ubi.tgz /agent/mongodb_agent.tgz
46+
47+
RUN tar xfz /tools/mongodb_tools.tgz
48+
RUN mv mongodb-database-tools-*/bin/* /tools
49+
RUN chmod +x /tools/*
50+
RUN rm /tools/mongodb_tools.tgz
51+
RUN rm -rf /mongodb-database-tools-*
52+
53+
RUN tar xfz /agent/mongodb_agent.tgz
54+
RUN mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent
55+
RUN chmod +x /agent/mongodb-agent
56+
RUN rm /agent/mongodb_agent.tgz
57+
RUN rm -rf mongodb-mms-automation-agent-*
58+
59+
RUN mkdir -p /var/lib/automation/config
60+
RUN chmod -R +r /var/lib/automation/config
61+
62+
USER 2000
63+
64+
HEALTHCHECK --timeout=30s CMD ls /opt/scripts/readinessprobe || exit 1
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
ARG imagebase
2+
FROM ${imagebase} as base
3+
4+
FROM registry.access.redhat.com/ubi9/ubi-minimal
5+
6+
ARG version
7+
8+
LABEL name="MongoDB Agent" \
9+
version="${version}" \
10+
summary="MongoDB Agent" \
11+
description="MongoDB Agent" \
12+
vendor="MongoDB" \
13+
release="1" \
14+
maintainer="[email protected]"
15+
16+
COPY --from=base /data/probe.sh /opt/scripts/probe.sh
17+
COPY --from=base /data/readinessprobe /opt/scripts/readinessprobe
18+
COPY --from=base /data/version-upgrade-hook /opt/scripts/version-upgrade-hook
19+
COPY --from=base /data/agent-launcher-lib.sh /opt/scripts/agent-launcher-lib.sh
20+
COPY --from=base /data/agent-launcher.sh /opt/scripts/agent-launcher.sh
21+
COPY --from=base /data/LICENSE /licenses/LICENSE
22+
23+
# Replace libcurl-minimal and curl-minimal with the full versions
24+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
25+
RUN microdnf install -y libssh libpsl libbrotli \
26+
&& microdnf download curl libcurl \
27+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
28+
&& microdnf remove -y libcurl-minimal curl-minimal
29+
30+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
31+
# Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
32+
RUN microdnf install -y --disableplugin=subscription-manager \
33+
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
34+
# Dependencies for the Agent
35+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
36+
net-snmp \
37+
net-snmp-agent-libs
38+
RUN microdnf install -y --disableplugin=subscription-manager \
39+
hostname tar gzip procps jq \
40+
&& microdnf upgrade -y \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
44+
COPY --from=base /data/mongodb_tools_ubi.tgz /tools/mongodb_tools.tgz
45+
COPY --from=base /data/mongodb_agent_ubi.tgz /agent/mongodb_agent.tgz
46+
47+
RUN tar xfz /tools/mongodb_tools.tgz
48+
RUN mv mongodb-database-tools-*/bin/* /tools
49+
RUN chmod +x /tools/*
50+
RUN rm /tools/mongodb_tools.tgz
51+
RUN rm -rf /mongodb-database-tools-*
52+
53+
RUN tar xfz /agent/mongodb_agent.tgz
54+
RUN mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent
55+
RUN chmod +x /agent/mongodb-agent
56+
RUN rm /agent/mongodb_agent.tgz
57+
RUN rm -rf mongodb-mms-automation-agent-*
58+
59+
RUN mkdir -p /var/lib/automation/config
60+
RUN chmod -R +r /var/lib/automation/config
61+
62+
USER 2000
63+
64+
HEALTHCHECK --timeout=30s CMD ls /opt/scripts/readinessprobe || exit 1
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
ARG imagebase
2+
FROM ${imagebase} as base
3+
4+
FROM registry.access.redhat.com/ubi9/ubi-minimal
5+
6+
ARG version
7+
8+
LABEL name="MongoDB Agent" \
9+
version="${version}" \
10+
summary="MongoDB Agent" \
11+
description="MongoDB Agent" \
12+
vendor="MongoDB" \
13+
release="1" \
14+
maintainer="[email protected]"
15+
16+
# Replace libcurl-minimal and curl-minimal with the full versions
17+
# https://bugzilla.redhat.com/show_bug.cgi?id=1994521
18+
RUN microdnf install -y libssh libpsl libbrotli \
19+
&& microdnf download curl libcurl \
20+
&& rpm -Uvh --nodeps --replacefiles "*curl*$( uname -i ).rpm" \
21+
&& microdnf remove -y libcurl-minimal curl-minimal
22+
23+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 nss_wrapper
24+
# Copy-pasted from https://www.mongodb.com/docs/manual/tutorial/install-mongodb-enterprise-on-red-hat-tarball/
25+
RUN microdnf install -y --disableplugin=subscription-manager \
26+
cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs openldap openssl xz-libs
27+
# Dependencies for the Agent
28+
RUN microdnf install -y --disableplugin=subscription-manager --setopt=install_weak_deps=0 \
29+
net-snmp \
30+
net-snmp-agent-libs
31+
RUN microdnf install -y --disableplugin=subscription-manager \
32+
hostname tar gzip procps jq \
33+
&& microdnf upgrade -y \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
RUN mkdir -p /agent \
37+
&& mkdir -p /var/lib/mongodb-mms-automation \
38+
&& mkdir -p /var/log/mongodb-mms-automation/ \
39+
&& chmod -R +wr /var/log/mongodb-mms-automation/ \
40+
# ensure that the agent user can write the logs in OpenShift
41+
&& touch /var/log/mongodb-mms-automation/readiness.log \
42+
&& chmod ugo+rw /var/log/mongodb-mms-automation/readiness.log
43+
44+
45+
COPY --from=base /data/mongodb-agent.tar.gz /agent
46+
COPY --from=base /data/mongodb-tools.tgz /agent
47+
COPY --from=base /data/LICENSE /licenses/LICENSE
48+
49+
RUN tar xfz /agent/mongodb-agent.tar.gz \
50+
&& mv mongodb-mms-automation-agent-*/mongodb-mms-automation-agent /agent/mongodb-agent \
51+
&& chmod +x /agent/mongodb-agent \
52+
&& mkdir -p /var/lib/automation/config \
53+
&& chmod -R +r /var/lib/automation/config \
54+
&& rm /agent/mongodb-agent.tar.gz \
55+
&& rm -r mongodb-mms-automation-agent-*
56+
57+
RUN tar xfz /agent/mongodb-tools.tgz --directory /var/lib/mongodb-mms-automation/ && rm /agent/mongodb-tools.tgz
58+
59+
USER 2000
60+
CMD ["/agent/mongodb-agent", "-cluster=/var/lib/automation/config/automation-config.json"]

0 commit comments

Comments
 (0)