Skip to content
Snippets Groups Projects
Commit 235246de authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Use shell instead of gitpython

parent 80d58f4e
No related branches found
No related tags found
No related merge requests found
......@@ -4,16 +4,22 @@ import subprocess as sp
import sys
import time
import git
REGISTRY_URL = 'docker.km3net.de'
def get_changed_dockerfiles():
"""Checks the last Git commit and returns a list of changed Dockefiles"""
diff_cmd = "git diff-tree --no-commit-id --name-only -r HEAD"
child = sp.Popen(diff_cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
out, _ = child.communicate()
changed_files = [l.decode().rstrip() for l in out.split(b'\n')]
changed_dockerfiles = [f for f in changed_files if f.startswith("base/")]
return changed_dockerfiles
def main():
changed_dockerfiles = [
f.a_path for f in git.Repo('.').index.diff("HEAD~1")
if f.a_path.startswith("base/")
]
changed_dockerfiles = get_changed_dockerfiles()
n_files = len(changed_dockerfiles)
if n_files == 0:
......
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