From 5fb8cef38353f27d40b89b62a60b1c48e1a1dd5f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 23 Sep 2026 09:41:49 +0200 Subject: image-builder: retry docker build once on failure The -current full build failed on 2026-09-23 after all ten steps had passed, at layer export, losing a race on the containerd snapshotter's content lock ("failed to open writer: ref ... locked for 74ms ... unavailable"). Disk was not the issue this time (73G free). The build cache pre-prune that works around this only runs under --force, so the normal gated nightly build had no guard. Add docker_build() to lib.sh: docker build, retried once. By the time the export fails every step is cached, so the retry is little more than a re-export. Used by build-full-image.sh and build-sbo-testbuild.sh, the two scripts that export ~20-33G images; bootstrap.sh's image is small and has never hit this. Self-check covers success, one failure, and two failures with a stub. Co-Authored-By: Claude Opus 5.5 --- image-builder/test-image-builder.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'image-builder/test-image-builder.sh') diff --git a/image-builder/test-image-builder.sh b/image-builder/test-image-builder.sh index 19f3ff8..fe6cff6 100755 --- a/image-builder/test-image-builder.sh +++ b/image-builder/test-image-builder.sh @@ -83,6 +83,18 @@ DOCKER_RC=0 ( require_docker ) 2>/dev/null; check_rc "require_docker daemon up" 0 $? unset -f docker +# --- docker_build: one retry, then give up --- +# Stub fails the first FAILS calls, counting attempts in a file (the calls run +# in $() subshells, so a shell variable would not survive). +docker() { local n; n=$(( $(cat "$tmp/calls") + 1 )); echo "$n" > "$tmp/calls"; (( n > FAILS )); } +for FAILS in 0 1 2; do + echo 0 > "$tmp/calls" + ( docker_build -t x . ) 2>/dev/null; rc=$? + check_rc "docker_build rc after $FAILS failures" "$(( FAILS > 1 ))" "$rc" + check "docker_build attempts after $FAILS failures" "$(( FAILS > 1 ? 2 : FAILS + 1 ))" "$(cat "$tmp/calls")" +done +unset -f docker + # --- registry-gc.sh: -V / --help parse without touching docker; syntax valid --- gc_ver="$(sed -n 's/^PROJECT_VERSION="\([^"]*\)".*/\1/p' registry-gc.sh)" check "registry-gc.sh -V" "registry-gc.sh $gc_ver" "$(bash ./registry-gc.sh -V)" -- cgit v1.2.3