[Feature request] apk add --retry flag.
Feature request:
I would love to see a flag added to the apk tool making it possible to "retry" failed package installs. Preferably with a --retry <times>
option.
What it would do: just try the exact same thing again until times
are reached or it is installed.
Why tho?:
From time to time when I install packages with apk, I get errors, the errors are usually solved by just running the same get
command again. For example, today I have in my CI scripts been getting the following type of errors on a whole lot of images:
/ # apk add --no-cache curl
fetch https://ftp.acc.umu.se/mirror/alpinelinux.org/v3.11/main/x86_64/APKINDEX.tar.gz
fetch https://ftp.acc.umu.se/mirror/alpinelinux.org/v3.11/community/x86_64/APKINDEX.tar.gz
(1/4) Installing ca-certificates (20191127-r0)
(2/4) Installing nghttp2-libs (1.40.0-r0)
(3/4) Installing libcurl (7.67.0-r0)
56% ██████████████████████████████████████████████████████████████████████████████████████████████████ 140118755360072:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1913:
ERROR: libcurl-7.67.0-r0: Permission denied
(4/4) Installing curl (7.67.0-r0)
85% █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 140118755360072:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1913:
ERROR: curl-7.67.0-r0: Permission denied
Executing busybox-1.31.1-r8.trigger
Executing ca-certificates-20191127-r0.trigger
2 errors; 6 MiB in 16 packages
I would guess that this have to do with some error on the UMU mirrors end (due to the permission error), but sometimes the next "retry" works fine, mostly though, the same error happens again on another package.
Running with --retry
would ofcourse not remove the issue, while it would make it possible to successfully fetch the package at the end.
Another approach could be to allow for secondary repositories to use as fallback:
/etc/apk/repositories
# Primary repositories.
https://ftp.acc.umu.se/mirror/alpinelinux.org/v3.11/main
https://ftp.acc.umu.se/mirror/alpinelinux.org/v3.11/community
# Fallback repositories.
https://ftp.halifax.rwth-aachen.de/alpine/v3.11/main
https://ftp.halifax.rwth-aachen.de/alpine/v3.11/community
I read that this should work, but in my case, it does not seem to work...