From 858c0ab252cbea01faf45e10214f06c5d09b600c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 24 Jul 2025 13:32:40 +0200 Subject: [PATCH] Add retries to skopeo inspect calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These can fail for any transient networking reason. Let's make a few attempts before giving up. Signed-off-by: Lubomír Sedlář (cherry picked from commit 2c289729b9b24300f18ca5ca2eb1edd83da63a53) --- pungi/util.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pungi/util.py b/pungi/util.py index a110e5a9..eb468212 100644 --- a/pungi/util.py +++ b/pungi/util.py @@ -281,14 +281,6 @@ class ContainerTagResolver(object): return url.replace(tag, f"@{digest}") -def _skopeo_inspect(url): - """Wrapper for running `skopeo inspect {url}` and parsing the output.""" - cp = subprocess.run( - ["skopeo", "inspect", url], stdout=subprocess.PIPE, check=True, encoding="utf-8" - ) - return json.loads(cp.stdout) - - # format: {arch|*: [data]} def get_arch_data(conf, var_name, arch): result = [] @@ -1081,3 +1073,14 @@ def format_size(sz): unit += 1 return "%.3g %sB" % (sz, UNITS[unit]) + + +@retry(interval=60, timeout=300, wait_on=RuntimeError) +def _skopeo_inspect(url): + """Wrapper for running `skopeo inspect {url}` and parsing the output. + Retries on failure. + """ + cp = subprocess.run( + ["skopeo", "inspect", url], stdout=subprocess.PIPE, check=True, encoding="utf-8" + ) + return json.loads(cp.stdout)