Add retries to skopeo inspect calls
These can fail for any transient networking reason. Let's make a few attempts before giving up. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com> (cherry picked from commit 2c289729b9b24300f18ca5ca2eb1edd83da63a53)
This commit is contained in:
parent
d818c781f9
commit
858c0ab252
@ -281,14 +281,6 @@ class ContainerTagResolver(object):
|
|||||||
return url.replace(tag, f"@{digest}")
|
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]}
|
# format: {arch|*: [data]}
|
||||||
def get_arch_data(conf, var_name, arch):
|
def get_arch_data(conf, var_name, arch):
|
||||||
result = []
|
result = []
|
||||||
@ -1081,3 +1073,14 @@ def format_size(sz):
|
|||||||
unit += 1
|
unit += 1
|
||||||
|
|
||||||
return "%.3g %sB" % (sz, UNITS[unit])
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user