Skip to content
Snippets Groups Projects
Commit cd449dbd authored by ale's avatar ale
Browse files

Catch 404 errors when accessing non-existing projects

parent 5d594ae0
No related branches found
No related tags found
No related merge requests found
......@@ -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?://[^/]+/)([^:]+)(:.*)?$')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment