This commit is contained in:
@@ -21,9 +21,9 @@ def deploy(tag = None, host = None):
|
|||||||
command = construct_command(tag, host)
|
command = construct_command(tag, host)
|
||||||
|
|
||||||
if tag:
|
if tag:
|
||||||
print(f"Deploying {tag}...\n")
|
print(f"[MAIN] Deploying {tag}...")
|
||||||
else:
|
else:
|
||||||
print(f"Deploying {host}...\n")
|
print(f"[MAIN] Deploying host {host}...")
|
||||||
res = subprocess.run(command, shell=True, stdout=subprocess.DEVNULL)
|
res = subprocess.run(command, shell=True, stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
return res.returncode == 0
|
return res.returncode == 0
|
||||||
@@ -75,6 +75,8 @@ def main():
|
|||||||
|
|
||||||
deployed = []
|
deployed = []
|
||||||
failed = []
|
failed = []
|
||||||
|
|
||||||
|
print("\n")
|
||||||
for task in new_diff:
|
for task in new_diff:
|
||||||
deployment = deploy(tag=task)
|
deployment = deploy(tag=task)
|
||||||
|
|
||||||
@@ -82,7 +84,9 @@ def main():
|
|||||||
failed.append(task)
|
failed.append(task)
|
||||||
else:
|
else:
|
||||||
deployed.append(task)
|
deployed.append(task)
|
||||||
|
print("\n")
|
||||||
|
|
||||||
|
print("\n")
|
||||||
for task in removed_containers:
|
for task in removed_containers:
|
||||||
print(f"[MAIN] Attempting to remove containers related to '{task}'...")
|
print(f"[MAIN] Attempting to remove containers related to '{task}'...")
|
||||||
task_name = task.split("/")[1].split(".")[0]
|
task_name = task.split("/")[1].split(".")[0]
|
||||||
@@ -98,6 +102,7 @@ def main():
|
|||||||
subprocess.run(f"/usr/bin/docker container rm {docker_container_id}", shell=True, stdout=subprocess.DEVNULL)
|
subprocess.run(f"/usr/bin/docker container rm {docker_container_id}", shell=True, stdout=subprocess.DEVNULL)
|
||||||
subprocess.run("/usr/bin/docker image prune -f", shell=True, stdout=subprocess.DEVNULL)
|
subprocess.run("/usr/bin/docker image prune -f", shell=True, stdout=subprocess.DEVNULL)
|
||||||
subprocess.run("/usr/bin/docker container prune -f", shell=True, stdout=subprocess.DEVNULL)
|
subprocess.run("/usr/bin/docker container prune -f", shell=True, stdout=subprocess.DEVNULL)
|
||||||
|
print("\n")
|
||||||
|
|
||||||
if len(failed) <= 0 and len(deployed) > 0:
|
if len(failed) <= 0 and len(deployed) > 0:
|
||||||
print("\n---------------------")
|
print("\n---------------------")
|
||||||
|
|||||||
Reference in New Issue
Block a user