hopefully catch that case
All checks were successful
Deploy Containers / Prepare (push) Successful in 5s
All checks were successful
Deploy Containers / Prepare (push) Successful in 5s
This commit is contained in:
@@ -8,7 +8,6 @@ quote_regex = r'"([^"]*)"'
|
|||||||
|
|
||||||
def git_diff():
|
def git_diff():
|
||||||
args = sys.argv
|
args = sys.argv
|
||||||
print(args[1], args[2])
|
|
||||||
res = subprocess.run(f"git diff --name-only {args[1]} {args[2]}", capture_output=True, shell=True, text=True)
|
res = subprocess.run(f"git diff --name-only {args[1]} {args[2]}", capture_output=True, shell=True, text=True)
|
||||||
return res.stdout.strip().split("\n")
|
return res.stdout.strip().split("\n")
|
||||||
|
|
||||||
@@ -26,20 +25,27 @@ def run_deployment(tag = None):
|
|||||||
|
|
||||||
print(f"Running deployment for {tag}..")
|
print(f"Running deployment for {tag}..")
|
||||||
res = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
res = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
lines = res.stdout.decode(encoding='utf-8').split("\n")
|
stdout_lines = res.stdout.decode(encoding='utf-8').split("\n")
|
||||||
print(res.stdout, res.stderr, command)
|
stderr_lines = res.stderr.decode(encoding='utf-8').split("\n")
|
||||||
|
|
||||||
|
|
||||||
success = True
|
success = True
|
||||||
for ind, line in enumerate(lines):
|
for ind, line in enumerate(stdout_lines):
|
||||||
if "fatal:" in line:
|
if "fatal:" in line:
|
||||||
success = False
|
success = False
|
||||||
host = re.findall(bracket_regex, line)[0]
|
host = re.findall(bracket_regex, line)[0]
|
||||||
task_failed = re.findall(bracket_regex, lines[ind - 1])[0]
|
task_failed = re.findall(bracket_regex, stdout_lines[ind - 1])[0]
|
||||||
reason_failed = re.findall(quote_regex, line)
|
reason_failed = re.findall(quote_regex, line)
|
||||||
|
|
||||||
print(f"\n{tag} failed deployment!\n{host}\n{reason_failed}\n{task_failed}\n")
|
print(f"\n{tag} failed deployment!\n{host}\n{reason_failed}\n{task_failed}\n")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
for ind, line in enumerate(stderr_lines):
|
||||||
|
if "error:" in line.lower():
|
||||||
|
success = False
|
||||||
|
print(f"{tag} failed deployment! {line}")
|
||||||
|
break
|
||||||
|
|
||||||
return success
|
return success
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user