Compare commits
2 commits
b3be74ad3a
...
5987264890
Author | SHA1 | Date | |
---|---|---|---|
5987264890 | |||
4fa36f7bde |
1 changed files with 31 additions and 14 deletions
|
@ -6,23 +6,40 @@ from re import match
|
||||||
from shlex import quote
|
from shlex import quote
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
|
|
||||||
commit_before_sha = getenv('CI_COMMIT_BEFORE_SHA')
|
commit_before_sha = getenv("CI_COMMIT_BEFORE_SHA")
|
||||||
commit_sha = getenv('CI_COMMIT_SHA')
|
commit_sha = getenv("CI_COMMIT_SHA")
|
||||||
commit_ref_name = getenv('CI_COMMIT_REF_NAME')
|
commit_ref_name = getenv("CI_COMMIT_REF_NAME")
|
||||||
directories = set()
|
directories = set()
|
||||||
|
dockerfile_updated = False
|
||||||
|
|
||||||
cmd = 'git clone https://code.ryuslash.org/ryuslash/git-lfs-test.git .'
|
cmd = "git clone https://code.ryuslash.org/ryuslash/git-lfs-test.git ."
|
||||||
print(cmd)
|
print(cmd)
|
||||||
run(cmd, shell=True)
|
run(cmd, shell=True)
|
||||||
|
|
||||||
|
cmd = "docker images ryuslash.org/freeloadio"
|
||||||
|
print(cmd)
|
||||||
|
process = run(cmd, shell=True, capture_output=True)
|
||||||
|
process_output = process.stdout.decode()
|
||||||
|
|
||||||
|
if len(process_output.strip().split("\n")) == 1:
|
||||||
|
# We don't have any docker file at all yet.
|
||||||
|
dockerfile_updated = True
|
||||||
|
|
||||||
if not match(r"^0+$", commit_before_sha):
|
if not match(r"^0+$", commit_before_sha):
|
||||||
cmd = f"git diff --name-only {quote(commit_before_sha)} {quote(commit_sha)}"
|
cmd = f"git diff --name-only {quote(commit_before_sha)} {quote(commit_sha)}"
|
||||||
print(cmd)
|
print(cmd)
|
||||||
process = run(cmd, shell=True, capture_output=True)
|
process = run(cmd, shell=True, capture_output=True)
|
||||||
process_output = process.stdout.decode()
|
process_output = process.stdout.decode()
|
||||||
print(process_output)
|
print(process_output)
|
||||||
for filename in process_output.strip().split('\n'):
|
for filename in process_output.strip().split("\n"):
|
||||||
|
if filename == "Dockerfile":
|
||||||
|
dockerfile_updated = True
|
||||||
directories.add(dirname(filename))
|
directories.add(dirname(filename))
|
||||||
|
|
||||||
unix_directory_list = str.join(':', directories)
|
if dockerfile_updated:
|
||||||
print(f'python tasks.py probe --directories={quote(unix_directory_list)}')
|
cmd = "docker build -t ryuslash.org/freeloadio:latest ."
|
||||||
|
print(cmd)
|
||||||
|
run(cmd, shell=True)
|
||||||
|
|
||||||
|
unix_directory_list = str.join(":", directories)
|
||||||
|
print(f"python tasks.py probe --directories={quote(unix_directory_list)}")
|
||||||
|
|
Loading…
Reference in a new issue