#!/usr/bin/env bash # The command the pipeline runs, and what it produces. Then the same command with no Docker. source "$(dirname "$0")/lib.sh" { banner "mvn -B -ntp verify (key lines)" "${MVN[@]}" clean verify 2>&1 | clean | grep -E '^\[INFO\] --- |Tests run:|BUILD|cyclonedx.*attaching|Replacing main' | sed -E 's/ @ gitea-actions-demo//; s/ in com.ankurm.ci.*/ in /; s/, Time elapsed: [0-9.]+ s//' banner "target/ after the build" ls target | grep -E '\.(jar|original)$' | sort # Why the socket is masked instead of just setting DOCKER_HOST to a bad value: Testcontainers tries the # DOCKER_HOST strategy first and then falls back to the default /var/run/docker.sock. A first draft of # this script only set DOCKER_HOST=unix:///nonexistent.sock and the build still passed. banner "Same command where Docker is really unreachable (docker.sock masked in a private mount namespace)" unshare -m bash -c 'mount --bind /dev/null /var/run/docker.sock && DOCKER_HOST=unix:///var/run/docker.sock mvn -B -ntp verify' 2>&1 | clean \ | grep -E 'Tests run:|Could not find a valid Docker|BUILD|ERROR\] +(TicketApiIT|Tests run)' | sed -E 's/, Time elapsed: [0-9.]+ s//; s/ in com.ankurm.ci.*/ in /' | cut -c1-200 | awk '!seen[$0]++' } 2>&1 | tee "$OUT/03-build-test.txt"