Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
eb7ea504
Commit
eb7ea504
authored
Jul 27, 2017
by
syed-awais-ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add modified dockerfiles to the list of plays
parent
6a3342cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
3 deletions
+29
-3
util/parsefiles.py
+29
-3
No files found.
util/parsefiles.py
View file @
eb7ea504
...
...
@@ -182,7 +182,7 @@ def change_set_to_roles(files, git_dir, roles_dirs, playbooks_dirs, graph):
return
items
def
get_plays
(
files
,
git_dir
,
playbooks_dirs
):
"""
"""
Determines which files in the change set are aws playbooks
files: A list of files modified by a commit range.
...
...
@@ -210,7 +210,7 @@ def get_plays(files, git_dir, playbooks_dirs):
plays
.
add
(
_get_playbook_name_from_file
(
file_path
))
return
plays
def
_get_playbook_name_from_file
(
path
):
"""
Gets name of playbook from the filepath, which is the last part of the filepath.
...
...
@@ -220,7 +220,7 @@ def _get_playbook_name_from_file(path):
"""
# get last part of filepath
return
path
.
stem
def
_get_role_name_from_file
(
path
):
"""
...
...
@@ -330,6 +330,29 @@ def _get_role_name(role):
LOGGER
.
warning
(
"role
%
s could not be resolved to a role name."
%
role
)
return
None
def
_get_modified_dockerfiles
(
files
,
git_dir
):
"""
Return Playbooks whose dockerfile has been changed/modified
:param files:
:param git_dir:
:return:
"""
items
=
set
()
for
play
in
plays
:
dockerfile
=
pathlib2
.
Path
(
DOCKER_PATH_ROOT
,
play
,
"Dockerfile"
)
for
f
in
files
:
file_path
=
pathlib2
.
Path
(
git_dir
,
f
)
if
file_path
in
dockerfile
:
items
.
add
(
_get_playbook_name_from_file
(
file_path
))
return
items
def
arg_parse
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Given a commit range, analyze Ansible dependencies between roles and playbooks '
...
...
@@ -387,5 +410,8 @@ if __name__ == '__main__':
# filter out docker plays without a Dockerfile
docker_plays
=
filter_docker_plays
(
docker_plays
,
TRAVIS_BUILD_DIR
)
# Add playbooks to the list whose docker file has been modified
modified_docer_files
=
_get_modified_dockerfiles
(
docker_plays
,
TRAVIS_BUILD_DIR
)
# prints Docker plays
print
" "
.
join
(
str
(
play
)
for
play
in
docker_plays
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment