Skip to content

Commit dcbd198

Browse files
committed
CI: Fix ARM64 apt retry to detect partial failures
The previous retry mechanism had a critical flaw: apt update returns exit code 0 even when some files fail to download, as long as SOME updates succeed. This caused the retry loop to break immediately even when errors like "Failed to fetch" occurred.
1 parent b1e4825 commit dcbd198

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,17 +303,20 @@ jobs:
303303
# No 'sudo' is available
304304
install: |
305305
# Retry apt update with delays to handle mirror sync issues
306+
# apt update returns 0 even with partial failures, so check logs
306307
for i in 1 2 3 4 5; do
307-
if apt update -qq --allow-releaseinfo-change 2>&1 | tee /tmp/apt-update.log; then
308+
apt update -qq --allow-releaseinfo-change 2>&1 | tee /tmp/apt-update.log
309+
if ! grep -q "Failed to fetch\|Hash Sum mismatch" /tmp/apt-update.log; then
310+
echo "apt update succeeded on attempt $i"
308311
break
309312
fi
310-
echo "apt update attempt $i failed, waiting 10 seconds..."
311-
sleep 10
313+
if [ $i -lt 5 ]; then
314+
echo "apt update attempt $i had errors, waiting 10 seconds before retry..."
315+
sleep 10
316+
else
317+
echo "Warning: apt update still has errors after 5 attempts, proceeding anyway..."
318+
fi
312319
done
313-
# Show errors if apt update failed
314-
if grep -q "Failed to fetch\|Hash Sum mismatch" /tmp/apt-update.log; then
315-
echo "Warning: apt update had issues but continuing..."
316-
fi
317320
apt install -yqq make git curl wget clang libsdl2-dev libsdl2-mixer-dev lsb-release software-properties-common gnupg bc
318321
which wget || echo "WARNING: wget not found after installation"
319322
# FIXME: gcc build fails on Aarch64/Linux hosts
@@ -324,11 +327,14 @@ jobs:
324327
# Verify and install wget if needed (workaround for install step issues)
325328
if ! command -v wget > /dev/null 2>&1; then
326329
for i in 1 2 3; do
327-
if apt update -qq --allow-releaseinfo-change; then
330+
apt update -qq --allow-releaseinfo-change 2>&1 | tee /tmp/apt-update-wget.log
331+
if ! grep -q "Failed to fetch\|Hash Sum mismatch" /tmp/apt-update-wget.log; then
328332
break
329333
fi
330-
echo "apt update retry $i failed, waiting 10 seconds..."
331-
sleep 10
334+
if [ $i -lt 3 ]; then
335+
echo "apt update retry $i had errors, waiting 10 seconds..."
336+
sleep 10
337+
fi
332338
done
333339
apt install -yqq wget
334340
fi

0 commit comments

Comments
 (0)