ci: retry pulling container images up to 10x

There seems to be some failing network component in the CI environment
that prevents pulling container images. Even pulling it from the
registry to my laptop fails often, but with a few retries everything
gets pulled eventually.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-01-30 16:20:03 +01:00 committed by mergify[bot]
parent e61b2f4aaf
commit 97afd83f2b

View File

@ -38,8 +38,28 @@ def create_duffy_config() {
// pulling from the destination registry. // pulling from the destination registry.
// //
// Images need to be pre-pushed into the source registry, though. // Images need to be pre-pushed into the source registry, though.
//
// On occasion pulling images is not stable due to a broken proxy in the CI
// environment. For that, try pulling the image up to 10x.
def podman_pull(source, destination, image) { def podman_pull(source, destination, image) {
ssh "podman pull --authfile=~/.podman-auth.json ${source}/${image} && podman tag ${source}/${image} ${image} ${destination}/${image}" def failed = null
for (i in 0..9) {
try {
ssh "podman pull --authfile=~/.podman-auth.json ${source}/${image} && podman tag ${source}/${image} ${image} ${destination}/${image}"
failed = null
break
}
catch (err) {
failed = err
// failed to pull image, but try again
}
}
// if the last pull failed, throw the error
if (failed != null) {
throw failed
}
} }
node('cico-workspace') { node('cico-workspace') {