Skip to content

Commit 8f0998b

Browse files
authored
Update configure-apt-mock.sh to enable parallelism
This adds a few errors that happen when another update/install process is running in parallel. `apt-get update` doesn't handle race conditions well, and `apt-get install` has one as well. This is pre-cursor to another change that enables parallelism in the packer templates to run the `install-*.sh` scripts parallel, as I mentioned in https://github.com/actions/runner-images/discussions/2320
1 parent 4aaad33 commit 8f0998b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

images/ubuntu/scripts/build/configure-apt-mock.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ while [ \$i -le 30 ];do
2626
if grep -q 'Could not get lock' \$err;then
2727
# apt db locked needs retry
2828
retry=true
29+
elif grep -q 'Could not get lock /var/lib/apt/lists/lock' \$err;then
30+
# apt update did not complete (race condition), needs retry
31+
retry=true
32+
elif grep -q 'Problem renaming the file /var/cache/apt/pkgcache.bin.* to /var/cache/apt/pkgcache.bin' \$err;then
33+
# apt-get did not complete (race condition), needs retry
34+
retry=true
35+
elif grep -q 'Problem renaming the file /var/cache/apt/srcpkgcache.bin.* to /var/cache/apt/srcpkgcache.bin' \$err;then
36+
# apt update did not complete (race condition), needs retry
37+
retry=true
2938
elif grep -q 'Could not open file /var/lib/apt/lists' \$err;then
3039
# apt update is not completed, needs retry
3140
retry=true

0 commit comments

Comments
 (0)