Commit 5aa7f23a authored by ale's avatar ale
Browse files

Scan Containerfile as well as Dockerfile for dependencies

parent e174d7fc
......@@ -48,6 +48,10 @@ def has_ci(gl, project_path, branch_name):
_from_rx = re.compile(r'^FROM\s+(\S+).*$', re.MULTILINE)
_dockerfiles = [
'Dockerfile',
'Containerfile',
]
def get_docker_deps(gl, project_path, branch_name):
......@@ -56,11 +60,16 @@ def get_docker_deps(gl, project_path, branch_name):
except Exception as e:
logging.error('error accessing project %s: %s', project_path, e)
return []
def _parse_dockerfile(file_path):
try:
f = p.files.get(file_path='Dockerfile', ref=branch_name)
f = p.files.get(file_path=file_path, ref=branch_name)
return _from_rx.findall(f.decode().decode('utf-8'))
except Exception:
return []
out = []
for file_path in _dockerfiles:
out.extend(_parse_dockerfile(file_path))
return out
def get_explicit_deps(gl, project_path, branch_name):
......
Supports Markdown
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