add success logging
All checks were successful
Deploy Containers / Prepare (push) Successful in 40s

This commit is contained in:
2025-08-01 00:38:15 -04:00
parent ea12af253b
commit 27c2e1df02
2 changed files with 24 additions and 3 deletions

View File

@@ -30,6 +30,8 @@ def run_deployment(server_name = None, tag = None):
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") lines = res.stdout.decode(encoding='utf-8').split("\n")
success = True
for ind, line in enumerate(lines): for ind, line in enumerate(lines):
if "fatal:" in line: if "fatal:" in line:
host = re.findall(bracket_regex, line)[0] host = re.findall(bracket_regex, line)[0]
@@ -43,16 +45,36 @@ def run_deployment(server_name = None, tag = None):
print(f" Reason: {reason_failed[2].split(":")[1].strip()}") print(f" Reason: {reason_failed[2].split(":")[1].strip()}")
print("---------------------\n") print("---------------------\n")
success = False
break
return success
def main(): def main():
diff = git_diff() diff = git_diff()
success = True
for file in diff: for file in diff:
if "host_vars" in file: if "host_vars" in file:
server_name = file.split("/")[1].split(".")[0] server_name = file.split("/")[1].split(".")[0]
run_deployment(server_name=server_name) state = run_deployment(server_name=server_name)
if not state:
success = False
break
if "tasks" in file: if "tasks" in file:
task_name = file.split("/")[1].split(".")[0] + "_deploy" task_name = file.split("/")[1].split(".")[0] + "_deploy"
run_deployment(tag=task_name) state = run_deployment(tag=task_name)
if not state:
success = False
break
if success:
print("\n---------------------")
print(" Deployment succeeded!")
print(f" Tasks: {", ".join(diff)}")
print("---------------------\n")
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@@ -70,4 +70,3 @@
STEAM_API_KEY: "{{ API_STEAM_API_KEY }}" STEAM_API_KEY: "{{ API_STEAM_API_KEY }}"
CONTACT_WEBHOOK: "{{ API_CONTACT_WEBHOOK }}" CONTACT_WEBHOOK: "{{ API_CONTACT_WEBHOOK }}"
JWT_KEY: "{{ API_JWT_KEY }}" JWT_KEY: "{{ API_JWT_KEY }}"
TEST: "TESTING"