Skip to content

Commit 8b25560

Browse files
authored
test(node): include dev-cert in dev hostos (#6389)
The dev-cert is necessary for the dev HostOS to contact the mock server used in nns_recovery_test
1 parent 91b2523 commit 8b25560

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

ic-os/components/hostos.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ component_files = {
8282
Label("networking/nftables/hostos/setup-nftables.service"): "/etc/systemd/system/setup-nftables.service",
8383
Label("networking/nftables/hostos/setup-nftables.sh"): "/opt/ic/bin/setup-nftables.sh",
8484
Label("networking/hosts"): "/etc/hosts",
85+
Label("networking/dev-certs/canister_http_test_ca.cert"): "/dev-certs/canister_http_test_ca.cert",
8586

8687
# ssh
8788
Label("ssh/generate-host-ssh-keys/generate-host-ssh-keys.sh"): "/opt/ic/bin/generate-host-ssh-keys.sh",

ic-os/hostos/context/Dockerfile

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
# argument MUST be given by the build script, otherwise build will fail.
1111
ARG BASE_IMAGE=
1212

13+
# We support prod and dev images
14+
ARG BUILD_TYPE=
1315

14-
FROM $BASE_IMAGE
16+
17+
FROM $BASE_IMAGE as output_prod
1518

1619
USER root:root
1720

@@ -112,12 +115,6 @@ RUN systemctl disable \
112115
# ruleset.
113116
RUN ln -sf /run/ic-node/nftables-ruleset/nftables.conf /etc/nftables.conf
114117

115-
ARG ROOT_PASSWORD=
116-
RUN \
117-
if [ "${ROOT_PASSWORD}" != "" ]; then \
118-
echo "root:$(openssl passwd -6 -salt jE8zzDEHeRg/DuGq ${ROOT_PASSWORD})" | chpasswd -e ; \
119-
fi
120-
121118
# Clear additional files that may lead to indeterministic build.
122119
RUN rm -rf \
123120
/usr/local/share/qemu/edk2-arm-code.fd \
@@ -198,3 +195,28 @@ RUN find /opt -type d -exec chmod 0755 {} \+ && \
198195
find /opt -type f -exec chmod 0644 {} \+ && \
199196
chmod 0755 /opt/ic/bin/* && \
200197
chmod 0644 /opt/ic/share/*
198+
199+
# ------ DEV VARIANT ---------------------------------------------
200+
201+
# The following steps apply conditionally to the dev image ONLY
202+
# https://www.docker.com/blog/advanced-dockerfiles-faster-builds-and-smaller-images-using-buildkit-and-multistage-builds/#4374
203+
FROM output_prod as output_dev
204+
205+
USER root:root
206+
207+
# Set a root password if specified
208+
ARG ROOT_PASSWORD=
209+
RUN \
210+
if [ "${ROOT_PASSWORD}" != "" ]; then \
211+
echo "root:$(openssl passwd -6 -salt jE8zzDEHeRg/DuGq ${ROOT_PASSWORD})" | chpasswd -e ; \
212+
fi
213+
214+
# Include the dev root CA cert
215+
COPY dev-certs/canister_http_test_ca.cert /usr/local/share/ca-certificates/dev-root-ca.crt
216+
RUN chmod 0644 /usr/local/share/ca-certificates/dev-root-ca.crt
217+
RUN update-ca-certificates
218+
219+
220+
FROM output_${BUILD_TYPE}
221+
222+
USER root:root

0 commit comments

Comments
 (0)