aboutsummaryrefslogtreecommitdiffstats
path: root/image-builder/test-image-builder.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-07 13:09:39 +0200
committerDanilo M. <danix@danix.xyz>2026-09-07 13:09:39 +0200
commitf8c45fc28964a69d51fe41f967c9fe0734b68a72 (patch)
treea6c86db2d6b3a19037e0126efcc152f654d67558 /image-builder/test-image-builder.sh
parent6ae662fb92323ca4bbd2dd75062f8a38e9277ea8 (diff)
downloadsbo-dockerbuild-f8c45fc28964a69d51fe41f967c9fe0734b68a72.tar.gz
sbo-dockerbuild-f8c45fc28964a69d51fe41f967c9fe0734b68a72.zip
image-builder: abort early when the docker daemon is unreachable
A dead dockerd is a global failure, not a per-variant one, but every stage treated it as the latter: the digest probes read an unreachable daemon as "no digest, rebuilding to be safe", the build then failed, and the variant loop logged "WARNING: variant X failed; continuing" and moved on. Cron kept exiting nonzero into a log nobody read, so a daemon that died in August went unnoticed for 25 days while no image was ever rebuilt. Add require_docker() to lib.sh, following the existing require_mount() precedent, and call it before the variant loop in all three stages. One loud error, exit 1, instead of a nightly pile of warnings. In build-full-image.sh the check goes before the --force cache prune, since that prune also talks to the daemon. Self-check stubs `docker` so it never contacts a real daemon. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AD4jP4wFMpBgEvd9ZP9Xhu
Diffstat (limited to 'image-builder/test-image-builder.sh')
-rwxr-xr-ximage-builder/test-image-builder.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/image-builder/test-image-builder.sh b/image-builder/test-image-builder.sh
index 525ea8f..5781b22 100755
--- a/image-builder/test-image-builder.sh
+++ b/image-builder/test-image-builder.sh
@@ -75,6 +75,14 @@ MIRROR="file://$tmp/mnt"
MIRROR="https://example/x"
( require_mount current ) 2>/dev/null; check_rc "require_mount http skips" 0 $?
+# --- require_docker: stub `docker` so the check never touches a real daemon ---
+docker() { return "${DOCKER_RC:-0}"; }
+DOCKER_RC=1
+( require_docker ) 2>/dev/null; check_rc "require_docker daemon down" 1 $?
+DOCKER_RC=0
+( require_docker ) 2>/dev/null; check_rc "require_docker daemon up" 0 $?
+unset -f docker
+
echo "----"
echo "PASS: $pass FAIL: $fail"
[[ "$fail" -eq 0 ]]