Commit cd449dbd authored by ale's avatar ale

Catch 404 errors when accessing non-existing projects

parent 5d594ae0
Pipeline #7548 passed with stages
in 40 seconds
......@@ -51,7 +51,11 @@ _from_rx = re.compile(r'^FROM\s+(\S+).*$', re.MULTILINE)
def get_docker_deps(gl, project_path, branch_name):
p = gl.projects.get(project_path)
try:
p = gl.projects.get(project_path)
except Exception as e:
logging.error('error accessing project %s: %s', project_path, e)
return []
try:
f = p.files.get(file_path='Dockerfile', ref=branch_name)
return _from_rx.findall(f.decode().decode('utf-8'))
......@@ -60,7 +64,11 @@ def get_docker_deps(gl, project_path, branch_name):
def get_explicit_deps(gl, project_path, branch_name):
p = gl.projects.get(project_path)
try:
p = gl.projects.get(project_path)
except Exception as e:
logging.error('error accessing project %s: %s', project_path, e)
return []
try:
f = p.files.get(file_path='.gitlab-deps', ref=branch_name)
return f.decode().decode('utf-8').split('\n')
......@@ -80,7 +88,6 @@ def docker_image_to_project(docker_image, registry_hostname):
else:
branch = m[5]
return m[3], branch
return None, None
_url_rx = re.compile(r'^(https?://[^/]+/)([^:]+)(:.*)?$')
......
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