Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-deps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pipelines
tools
gitlab-deps
Commits
5aa7f23a
Commit
5aa7f23a
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Scan Containerfile as well as Dockerfile for dependencies
parent
e174d7fc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitlab_deps/deps.py
+14
-5
14 additions, 5 deletions
gitlab_deps/deps.py
with
14 additions
and
5 deletions
gitlab_deps/deps.py
+
14
−
5
View file @
5aa7f23a
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment