Skip to content

Commit 2386074

Browse files
authored
rework tests/Dockerfile - parallel + bun (#2911)
1 parent a8b7408 commit 2386074

File tree

6 files changed

+985
-154
lines changed

6 files changed

+985
-154
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ repos:
118118
hooks:
119119
- id: codespell
120120
name: check spelling
121-
exclude: ^helmfile\.d/charts/hnc/config-and-crds/crds/|^helmfile\.d/upstream/|tests/package-lock.json
121+
exclude: ^helmfile\.d/charts/hnc/config-and-crds/crds/|^helmfile\.d/upstream/|tests/package-lock.json|tests/bun.lock
122122
args:
123123
- -I
124124
- .codespellignore

tests/Dockerfile

Lines changed: 42 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -2,103 +2,41 @@
22
FROM ubuntu:24.04 AS unit
33
LABEL org.opencontainers.image.source=https://github.com/elastisys/compliantkubernetes-apps
44

5-
ARG DEBIAN_FRONTEND="noninteractive"
5+
ENV DEBIAN_FRONTEND="noninteractive"
66
ENV LANGUAGE="en"
77
ENV LANG="en_US.utf8"
8-
ARG TZ="Etc/UTC"
98

10-
RUN apt-get update -q=2 && \
11-
apt-get install -q=2 apache2-utils curl dnsutils gettext-base git gpg iputils-ping jq locales make net-tools nodejs parallel pwgen python3-venv s3cmd ssh unzip && \
12-
apt-get clean && \
9+
RUN apt-get -q=2 --update install apache2-utils curl dnsutils gettext-base git gpg iputils-ping jq locales make net-tools parallel pwgen python3-venv s3cmd ssh unzip >/dev/null && \
10+
apt-get -q=2 clean && \
1311
rm -rf /var/lib/apt/lists/* && \
1412
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
1513

16-
ARG GOMPLATE_VERSION="4.3.1"
17-
RUN curl -LOs "https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64" && \
18-
install -Tm 755 gomplate_linux-amd64 /usr/local/bin/gomplate && \
19-
rm gomplate_linux-amd64
20-
21-
ARG HELM_VERSION="3.18.4"
2214
ENV HELM_DATA_HOME="/usr/local/share/helm"
23-
RUN curl -LOs "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" && \
24-
tar -zxvf "helm-v${HELM_VERSION}-linux-amd64.tar.gz" linux-amd64/helm && \
25-
install -Tm 755 linux-amd64/helm /usr/local/bin/helm && \
26-
rm -rf linux-amd64 "helm-v${HELM_VERSION}-linux-amd64.tar.gz"
27-
28-
ARG HELM_DIFF_VERSION="3.10.0"
29-
RUN helm plugin install https://github.com/databus23/helm-diff --version "v${HELM_DIFF_VERSION}" > /dev/null
30-
31-
ARG HELM_SECRETS_VERSION="4.6.5"
32-
RUN helm plugin install https://github.com/jkroepke/helm-secrets --version "v${HELM_SECRETS_VERSION}" > /dev/null
33-
34-
ARG HELMFILE_VERSION="0.171.0"
35-
RUN curl -LOs "https://github.com/helmfile/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz" && \
36-
tar -zxvf "helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz" helmfile && \
37-
install -Tm 755 helmfile /usr/local/bin/helmfile && \
38-
rm helmfile "helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz"
39-
40-
ARG KUBECTL_VERSION="1.33.6"
41-
RUN curl -LOs "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" && \
42-
install -Tm 755 kubectl /usr/local/bin/kubectl && \
43-
rm kubectl
44-
45-
ARG KUBECONFORM_VERSION="0.6.7"
46-
RUN curl -LOs "https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" && \
47-
tar -zxvf kubeconform-linux-amd64.tar.gz kubeconform && \
48-
install -Tm 755 kubeconform /usr/local/bin/kubeconform && \
49-
rm kubeconform-linux-amd64.tar.gz kubeconform
50-
51-
ARG KUBELOGIN_VERSION="1.32.3"
52-
RUN curl -LOs "https://github.com/int128/kubelogin/releases/download/v${KUBELOGIN_VERSION}/kubelogin_linux_amd64.zip" && \
53-
unzip kubelogin_linux_amd64.zip && \
54-
install -Tm 755 kubelogin /usr/local/bin/kubectl-oidc_login && \
55-
rm kubelogin kubelogin_linux_amd64.zip LICENSE README.md
56-
57-
ARG OPA_VERSION="0.57.1"
58-
RUN curl -LOs "https://github.com/open-policy-agent/opa/releases/download/v${OPA_VERSION}/opa_linux_amd64" && \
59-
install -Tm 755 opa_linux_amd64 /usr/local/bin/opa && \
60-
rm opa_linux_amd64
61-
62-
ARG PROMETHEUS_VERSION="3.6.0"
63-
RUN curl -fsSL "https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz" | \
64-
tar -zxvf - "prometheus-${PROMETHEUS_VERSION}.linux-amd64/promtool" --strip-components=1 && \
65-
mv promtool /usr/local/bin/
66-
67-
ARG SOPS_VERSION="3.10.1"
68-
RUN curl -LOs "https://github.com/getsops/sops/releases/download/v${SOPS_VERSION}/sops-v${SOPS_VERSION}.linux.amd64" && \
69-
install -Tm 755 "sops-v${SOPS_VERSION}.linux.amd64" /usr/local/bin/sops && \
70-
rm "sops-v${SOPS_VERSION}.linux.amd64"
71-
72-
ARG YAJSV_VERSION="1.4.1"
73-
RUN curl -LOs "https://github.com/neilpa/yajsv/releases/download/v${YAJSV_VERSION}/yajsv.linux.amd64" && \
74-
echo "4bd6d2b1d6292ab1f7ba63db83c182a603a790d431429cf71f05cb0fcc677def yajsv.linux.amd64" | sha256sum -c - && \
75-
install -Tm 755 yajsv.linux.amd64 /usr/local/bin/yajsv && \
76-
rm yajsv.linux.amd64
77-
78-
ARG YQ_VERSION="4.45.1"
79-
RUN curl -LOs "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64" && \
80-
echo "654d2943ca1d3be2024089eb4f270f4070f491a0610481d128509b2834870049 yq_linux_amd64" | sha256sum -c - && \
81-
install -Tm 755 yq_linux_amd64 /usr/local/bin/yq && \
82-
rm yq_linux_amd64
83-
84-
ARG BATS_CORE_VERSION="1.11.1"
85-
RUN git clone --depth 1 https://github.com/bats-core/bats-core.git --branch "v${BATS_CORE_VERSION}" /tmp/bats-core && ./tmp/bats-core/install.sh /usr/local && rm -rf /tmp/bats-core
86-
87-
# Currently all from main as most do not have current releases
88-
RUN git clone --depth 1 https://github.com/bats-core/bats-assert.git /usr/local/lib/bats/assert
89-
RUN git clone --depth 1 https://github.com/bats-core/bats-detik.git /usr/local/lib/bats/detik
90-
RUN git clone --depth 1 https://github.com/bats-core/bats-file.git /usr/local/lib/bats/file
91-
RUN git clone --depth 1 https://github.com/grayhemp/bats-mock.git /usr/local/lib/bats/mock
92-
RUN git clone --depth 1 https://github.com/bats-core/bats-support.git /usr/local/lib/bats/support
93-
9415
ENV DOCS_PATH="/usr/local/share/docs"
95-
RUN git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/elastisys/welkin.git "${DOCS_PATH}" && \
96-
chmod -R a+w "${DOCS_PATH}" && \
97-
python3 -m venv /opt/docs-venv && \
98-
/opt/docs-venv/bin/python -m pip install --upgrade pip && \
99-
cd "${DOCS_PATH}" && \
100-
/opt/docs-venv/bin/pip install --no-cache-dir -r requirements.txt
101-
ENV PATH="/opt/docs-venv/bin:${PATH}"
16+
17+
COPY ./tests/common/install-tools.bash /opt/install-tools.bash
18+
RUN BATS_CORE_VERSION="1.11.1@sha256:b036dd11d2d22ff82a191233429f9d3e33c62ec6d3e6769243e7dfa3e7ca9908" \
19+
BATS_ASSERT_REV="697471b7a89d3ab38571f38c6c7c4b460d1f5e35" \
20+
BATS_DETIK_REV="ce86871d7fdaed7f31b0e11e228b7b91a58ac1cc" \
21+
BATS_FILE_REV="c0bb8ef329908cbb2c456c05ebb785d44553f7cd" \
22+
BATS_MOCK_REV="48fce74482a4d2bb879b904ccab31b6bc98e3224" \
23+
BATS_SUPPORT_REV="0954abb9925cad550424cebca2b99255d4eabe96" \
24+
GOMPLATE_VERSION="4.3.1@sha256:9f6c008a8ffa2574ce404acd31dd4efbdbde7aeaa867f0b8fd8dccd298cd282e" \
25+
HELM_VERSION="3.18.4@sha256:84d06a0f5ba17fd9c4d9912613453cdaa95a4f59c8baf20c195b74310b009ea6" \
26+
HELM_DIFF_VERSION="3.10.0@sha256:16db94ce5ad7a6cf55118b723111defdb7dc2b227f8f0886d6fdec2545fd02de" \
27+
HELM_SECRETS_VERSION="4.6.5" \
28+
HELMFILE_VERSION="0.171.0@sha256:8bd28d832b6d9fde9e770925a03d251a7672737b3248293bf52c0b3dfcc64e73" \
29+
KUBECTL_VERSION="1.33.6@sha256:d25d9b63335c038333bed785e9c6c4b0e41d791a09cac5f3e8df9862c684afbe" \
30+
KUBECONFORM_VERSION="0.6.7@sha256:9e867e86e277de971bed3cfe46cf07f1d08db212e9188389670b3685c38281e7" \
31+
KUBELOGIN_VERSION="1.32.3@sha256:d5288ae63d8d7e8cc5db3bc97ac3e3f979cf43b8aeb3e831acb27622b5d843b3" \
32+
OPA_VERSION="0.57.1@sha256:5212d513dad9bd90bc67743d7812e5ec7019b2a994f30c0d8dbb2b2c6772f094" \
33+
PROMTOOL_VERSION="3.6.0@sha256:3e7460d042ddc03c69bf9234c8495c0097d8533cef8add1e2ca04a4f9953488e" \
34+
SOPS_VERSION="3.10.1@sha256:1bc9fbce48e3fcc7e684d604d50f7c56721b6cd2d27f96ec74b8b56b5a96c942" \
35+
YAJSV_VERSION="1.4.1@sha256:4bd6d2b1d6292ab1f7ba63db83c182a603a790d431429cf71f05cb0fcc677def" \
36+
YQ_VERSION="4.45.1@sha256:654d2943ca1d3be2024089eb4f270f4070f491a0610481d128509b2834870049" \
37+
/opt/install-tools.bash unit
38+
39+
ENV PATH="${DOCS_PATH}/.venv/bin:${PATH}"
10240

10341
# Container to run integration and end-to-end tests
10442
FROM unit AS main
@@ -116,32 +54,25 @@ Architectures: $(dpkg --print-architecture) \n\
11654
Signed-by: /etc/apt/keyrings/microsoft.gpg" | tee /etc/apt/sources.list.d/azure-cli.sources
11755

11856
ARG AZ_VERSION=2.63.0
119-
RUN apt-get update -q=2 && \
120-
apt-get install -q=2 azure-cli=${AZ_VERSION}-1~${DIST} buildah docker.io libasound2t64 libatk1.0-0 libatk-bridge2.0-0 libcanberra-gtk-module \
57+
RUN apt-get -q=2 --update install azure-cli=${AZ_VERSION}-1~${DIST} buildah docker.io libasound2t64 libatk1.0-0 libatk-bridge2.0-0 libcanberra-gtk-module \
12158
libcanberra-gtk3-module libcups2 libgbm-dev libgbm1 libglib2.0-0 libgtk2.0-0 libgtk2.0-0t64 libgtk-3-0 \
122-
libgtk-3-0t64 libnotify-dev libnss3 libxss1 libxtst6 podman-remote skopeo socat xauth xvfb zstd && \
123-
apt-get clean && \
59+
libgtk-3-0t64 libnotify-dev libnss3 libxss1 libxtst6 podman-remote skopeo socat xauth xvfb zstd >/dev/null && \
60+
apt-get -q=2 clean && \
12461
rm -rf /var/lib/apt/lists/* && \
12562
ln -s /usr/bin/podman-remote /usr/bin/podman
12663

127-
ARG KIND_VERSION="0.30.0"
128-
RUN curl -LOs "https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-linux-amd64" && \
129-
install -Tm 755 kind-linux-amd64 /usr/local/bin/kind && \
130-
rm kind-linux-amd64
131-
132-
ARG VELERO_VERSION="1.13.0"
133-
RUN curl -LOs "https://github.com/vmware-tanzu/velero/releases/download/v${VELERO_VERSION}/velero-v${VELERO_VERSION}-linux-amd64.tar.gz" && \
134-
tar -zxvf "velero-v${VELERO_VERSION}-linux-amd64.tar.gz" "velero-v${VELERO_VERSION}-linux-amd64" && \
135-
install -Tm 755 "velero-v${VELERO_VERSION}-linux-amd64/velero" /usr/local/bin/velero && \
136-
rm -r "velero-v${VELERO_VERSION}-linux-amd64.tar.gz" "velero-v${VELERO_VERSION}-linux-amd64"
137-
13864
ENV NODE_PATH="/usr/local/lib/node_modules"
13965
ENV PATH="${PATH}:${NODE_PATH}/.bin"
140-
141-
COPY ./tests/package.json ./tests/package-lock.json ./
142-
RUN apt-get update -q=2 && apt-get install -q=2 npm && \
143-
npm ci --omit dev && mv node_modules /usr/local/lib/ && \
144-
apt-get autoremove --purge npm -q=2 && rm -rf /var/lib/apt/lists/* && rm -rf /root/.cache
145-
14666
ENV CYPRESS_CACHE_FOLDER=/usr/local/lib/cypress
147-
RUN cypress install && cypress verify
67+
68+
RUN KIND_VERSION="0.30.0@sha256:517ab7fc89ddeed5fa65abf71530d90648d9638ef0c4cde22c2c11f8097b8889" \
69+
VELERO_VERSION="1.13.0@sha256:1b6662eb06ecb974c96edd32296cc334c51af5e6c4d2d19408a285a20b771aba" \
70+
BUN_VERSION="1.3.5@sha256:a56093cbdd2efc7290a744ccc39971dcc4be52c5732be15c7fb1465cc119c8de" \
71+
/opt/install-tools.bash main
72+
73+
WORKDIR /opt/node-packages
74+
COPY ./tests/package.json ./tests/bun.lock ./
75+
RUN bun install --frozen-lockfile --production && \
76+
mv node_modules "${NODE_PATH}" && \
77+
cypress verify
78+
WORKDIR /

0 commit comments

Comments
 (0)