Commit 4d80f875 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

fix(core): handle failure to clone a repository

parent e621ff8b77eb
Pipeline #97837 failed with stage
in 48 seconds
......@@ -351,9 +351,12 @@ class Repository:
def __enter__(self):
self.temporary_directory = tempfile.TemporaryDirectory()
self.path = Path(self.temporary_directory.name)
self.run_command(f"hg clone {self.url} {self.temporary_directory.name}")
try:
self.run_command(f"hg clone {self.url} {self.temporary_directory.name}")
except Exception as e:
return None, e
return self
return self, None
def run_command(self, command, capture_output=False):
if capture_output:
......@@ -526,7 +529,11 @@ class Command:
if delay:
logger.debug(f"sleeping {delay} seconds before cloning to easy CI load")
sleep(delay)
with Repository(url=cube.attributes["web_url"]) as repo:
with Repository(url=cube.attributes["web_url"]) as (repo, error):
if error:
logger.exception(error)
continue
modifications = self.modify_code(
cube, repo, root_files, branches, other_args
)
......@@ -861,7 +868,11 @@ class NoMRCommand(Command):
logger.info(f'cloning {cube.attributes["web_url"]}')
# hg clone
with Repository(url=cube.attributes["web_url"]) as repo:
with Repository(url=cube.attributes["web_url"]) as (repo, error):
if error:
logger.exception(error)
continue
modifications = self.modify_code(
cube,
repo,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment