Files
computer-playbook/scripts/tests/dns/parallel.sh
T
kevinveenbirkenbachandClaude Fable 5 62a46e472f Merge branch 'feature/swarm-nfs' into feature/svc-net-tor
Resolves the runner Dockerfile to the lint-standard Acquire::Retries=3
and keeps the collabora TODO wording; hardens the merged tree for the
stricter lints (apt retries in the tor Dockerfile, shell-or-true
markers, comment cleanup).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 16:27:25 +02:00

67 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Args:
# $@ distro ids (space-separated), e.g. "arch debian ubuntu".
#
# Inputs via env:
# OWNER, REPO_NAME, GITHUB_SHA image coordinates
# -> ghcr.io/${OWNER}/${REPO_NAME}/${distro}:ci-${GITHUB_SHA}
# GHCR_USER, GHCR_TOKEN creds to pull the image from GHCR.
set -uo pipefail
: "${OWNER:?}" "${REPO_NAME:?}" "${GITHUB_SHA:?}"
read -r -a distros <<<"${*:-}"
: "${distros[0]:?no distros given}"
run_one() {
local d="$1"
local image="ghcr.io/${OWNER}/${REPO_NAME}/${d}:ci-${GITHUB_SHA}"
local name="dns-dind-${d}"
docker rm -f "${name}" >/dev/null 2>&1 || true # nocheck: shell-or-true -- cleanup of a possibly already-removed container
docker run -d --name "${name}" \
--privileged \
--cgroupns=host \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
--tmpfs /run \
--tmpfs /run/lock \
-v /sys/fs/cgroup:/sys/fs/cgroup:rw \
-v /lib/modules:/lib/modules:ro \
-e GITHUB_ACTIONS=true \
-e GITHUB_REPOSITORY_OWNER="${OWNER}" \
-e GITHUB_REPOSITORY="${OWNER}/${REPO_NAME}" \
-e INFINITO_BUILD=0 \
-e INFINITO_DISTRO="${d}" \
-e INFINITO_IMAGE="${image}" \
-e INFINITO_IMAGE_TAG="ci-${GITHUB_SHA}" \
-e INFINITO_PULL_POLICY=always \
-e GHCR_USER="${GHCR_USER:-}" \
-e GHCR_TOKEN="${GHCR_TOKEN:-}" \
"${image}" /sbin/init >/dev/null
docker exec "${name}" bash -lc 'exec "${INFINITO_SRC_DIR}/scripts/tests/dns/inside.sh"'
}
declare -A pid
for d in "${distros[@]}"; do
run_one "${d}" >"/tmp/dns-${d}.log" 2>&1 &
pid["${d}"]=$!
done
rc_total=0
for d in "${distros[@]}"; do
rc=0
wait "${pid[${d}]}" || rc=$?
echo "::group::DNS ${d} (exit ${rc})"
cat "/tmp/dns-${d}.log"
echo "::endgroup::"
if [[ "${rc}" -ne 0 ]]; then
echo "::error::DNS test failed for ${d}"
rc_total=1
fi
docker rm -f "dns-dind-${d}" >/dev/null 2>&1 || true # nocheck: shell-or-true -- cleanup of a possibly already-removed container
done
exit "${rc_total}"