diff --git a/gitlab_deps/deps.py b/gitlab_deps/deps.py index a00fe731136f2bbec55b8932d69678f42c90ec45..76068e47025056b4d0b0f74fe85766500bb5c40d 100644 --- a/gitlab_deps/deps.py +++ b/gitlab_deps/deps.py @@ -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 [] - try: - f = p.files.get(file_path='Dockerfile', ref=branch_name) - return _from_rx.findall(f.decode().decode('utf-8')) - except Exception: - return [] + def _parse_dockerfile(file_path): + try: + 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):