From 64e1c3010026e451e3f15dfdd92e0f2235147063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 18 Feb 2025 10:06:15 +0100 Subject: [PATCH] scm: Add retries to container-image download MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If all retries fail, let's also log the error output. Signed-off-by: Lubomír Sedlář (cherry picked from commit b99bcfb5eebf0d14d284fa0ab1bc2631d9e14ae3) --- pungi/wrappers/scm.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pungi/wrappers/scm.py b/pungi/wrappers/scm.py index aae5e847..4f689928 100644 --- a/pungi/wrappers/scm.py +++ b/pungi/wrappers/scm.py @@ -373,8 +373,16 @@ class ContainerImageScmWrapper(ScmBase): "oci:" + target_dir, "--remove-signatures", ] - self.log_debug("Exporting container %s to %s: %s", scm_root, target_dir, cmd) - run(cmd, can_fail=False) + try: + self.log_debug( + "Exporting container %s to %s: %s", scm_root, target_dir, cmd + ) + self.retry_run(cmd, can_fail=False) + except RuntimeError as e: + self.log_error( + "Failed to copy container image: %s %s", e, getattr(e, "output", "") + ) + raise def _get_wrapper(scm_type, *args, **kwargs):