Skip to content

Commit 7e9f546

Browse files
dmitrivMSCopilot
andauthored
Add retries to snap build (#314273)
* Add retries around snap build commands. Co-authored-by: Copilot <copilot@github.com>
1 parent 81ab96d commit 7e9f546

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

build/azure-pipelines/linux/apt-retry.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ while [ $i -le 30 ];do
2929
elif grep -q 'dpkg frontend is locked by another process' $err;then
3030
# dpkg process is busy by another process
3131
retry=true
32+
elif grep -q 'Failed to fetch' $err;then
33+
# transient network issue when downloading packages
34+
retry=true
35+
elif grep -q 'Unable to fetch some archives' $err;then
36+
# transient network issue when downloading packages
37+
retry=true
3238
fi
3339

3440
rm $err

build/azure-pipelines/linux/build-snap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ set -e
44
# Get snapcraft version
55
snapcraft --version
66

7+
# Configure apt to retry on transient network failures
8+
# This applies to both the apt commands below and snapcraft's internal apt operations for stage-packages
9+
sudo sh -c 'echo "Acquire::Retries \"5\";" > /etc/apt/apt.conf.d/80-retries'
10+
711
# Make sure we get latest packages
812
sudo apt-get update
913
sudo apt-get upgrade -y

0 commit comments

Comments
 (0)