Skip to content

Commit d65be57

Browse files
committed
Add snap build retry logic with core22 installation
Adds retry mechanism for Snap builds including: - Installing core22 snap base with 3 attempts and exponential backoff - Wrapping snapcraft pack with retry logic on failure - Starting snapd service and waiting for seed load - Proper error handling and exit codes
1 parent 8bcd251 commit d65be57

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,28 @@ jobs:
4545
if: runner.os == 'Linux'
4646
run: |
4747
sudo apt-get update
48-
sudo apt-get install -y ruby ruby-dev rpm flatpak flatpak-builder squashfs-tools appstream appstream-compose
48+
sudo apt-get install -y ruby ruby-dev rpm flatpak flatpak-builder squashfs-tools appstream appstream-compose snapd
4949
if ! command -v snapcraft >/dev/null 2>&1; then
5050
sudo snap install snapcraft --classic
5151
fi
52+
sudo systemctl start snapd.socket snapd.service >/dev/null 2>&1 || true
53+
sudo snap wait system seed.loaded >/dev/null 2>&1 || true
54+
55+
if ! snap list core22 >/dev/null 2>&1; then
56+
for attempt in 1 2 3; do
57+
if sudo snap install core22 --channel=latest/stable; then
58+
break
59+
fi
60+
if [ "$attempt" -eq 3 ]; then
61+
echo "Failed to install required snap base 'core22' after retries"
62+
exit 1
63+
fi
64+
echo "Retrying core22 installation ($attempt/3)..."
65+
sudo systemctl restart snapd.service >/dev/null 2>&1 || true
66+
sleep $((attempt * 10))
67+
done
68+
fi
69+
5270
sudo gem install --no-document fpm
5371
curl -L -o appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
5472
chmod +x appimagetool
@@ -342,7 +360,24 @@ jobs:
342360
343361
rm -f ./*.snap
344362
export SNAPCRAFT_PROJECT_VERSION="$VERSION"
345-
snapcraft --destructive-mode
363+
364+
SNAP_BUILD_OK=0
365+
for attempt in 1 2 3; do
366+
if snapcraft pack --destructive-mode; then
367+
SNAP_BUILD_OK=1
368+
break
369+
fi
370+
371+
echo "snapcraft pack failed (attempt ${attempt}/3), retrying..."
372+
sudo snap install core22 --channel=latest/stable >/dev/null 2>&1 || true
373+
sudo systemctl restart snapd.service >/dev/null 2>&1 || true
374+
sleep $((attempt * 12))
375+
done
376+
377+
if [ "$SNAP_BUILD_OK" -ne 1 ]; then
378+
echo "Snap build failed after retries"
379+
exit 1
380+
fi
346381
347382
SNAP_FILE=""
348383
for f in ./*.snap; do

0 commit comments

Comments
 (0)