From 8cfd3078132b25146b31555c65aa8855d19feb58 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Sat, 29 Aug 2026 00:13:39 -0700 Subject: [PATCH] fix(ci): treat an unreadable cache size as unstable when settling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The settle loop initialised prev='' and, after 4795d0426f made total() return empty on failure, two consecutive failed `buildctl du` reads compared equal and tripped the stability counter. The loop then exited after ~2s instead of its 120s bound — exactly when du is failing and the prune is most likely still deleting, which is the case the wait exists to cover. Handing back early there risks the builder post-step SIGKILLing buildkitd and skipping the sticky disk commit. An empty reading can only mean du failed. buildctl prints its `Total:` line unconditionally (cmd/buildctl/diskusage.go), so an empty cache still reports `Total: 0B` and settles normally. Guarding on a non-empty reading therefore costs nothing in the healthy paths: verified a steady value and an empty cache both still exit after 3 iterations, while a persistently failing du now waits out all 60. Reported by cubic on #7273. --- .github/actions/docker-build/action.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/actions/docker-build/action.yml b/.github/actions/docker-build/action.yml index 4aaf9959553..72d90e8e8bb 100644 --- a/.github/actions/docker-build/action.yml +++ b/.github/actions/docker-build/action.yml @@ -142,7 +142,14 @@ runs: prev=''; stable=0 for _ in $(seq 1 60); do cur="$(total)" - if [ "$cur" = "$prev" ]; then + # An empty reading means du FAILED, never that the cache is empty: + # buildctl prints its `Total:` line unconditionally (cmd/buildctl + # diskusage.go), so an empty cache still reports `Total: 0B`. Without + # the -n guard the initial prev='' matched two empty readings and the + # loop exited after ~2s -- precisely when du is failing and the prune + # is most likely still deleting. Treat it as unstable and wait out the + # bound instead. + if [ -n "$cur" ] && [ "$cur" = "$prev" ]; then stable=$((stable + 1)) [ "$stable" -ge 2 ] && break else