swap to splitlines/run
All checks were successful
Deploy Containers / Prepare (push) Successful in 4s

This commit is contained in:
2026-04-06 13:34:41 -04:00
parent 1e8933ee72
commit 3ff1c2c51f

View File

@@ -73,15 +73,21 @@ def main():
task_name = task task_name = task
print(f"[MAIN] Removal task name: {task_name}") print(f"[MAIN] Removal task name: {task_name}")
containers = subprocess.run(f'docker ps --filter "name={task_name}" -q', shell=True, stdout=subprocess.PIPE) result = subprocess.run(
print(containers.stdout) f'docker ps --filter "name={task_name}" -q',
for line in containers.stdout: shell=True,
container_id = line.strip().decode("utf8") capture_output=True
print(f"[MAIN] Found Docker container {container_id} related to {task_name}, removing..") )
subprocess.run(f"/usr/bin/docker container stop {container_id}", shell=True)
subprocess.run(f"/usr/bin/docker container rm {container_id}", shell=True) for line in result.stdout.splitlines():
subprocess.run("/usr/bin/docker image prune -f", shell=True) container_id = line.strip().decode("utf8")
subprocess.run("/usr/bin/docker container prune -f", shell=True) if not container_id:
continue
print(f"[MAIN] Found Docker container {container_id} related to {task_name}, removing..")
subprocess.run(f"/usr/bin/docker container stop {container_id}", shell=True)
subprocess.run(f"/usr/bin/docker container rm {container_id}", shell=True)
subprocess.run("/usr/bin/docker image prune -f", shell=True)
subprocess.run("/usr/bin/docker container prune -f", shell=True)
if deployed and len(new_diff) > 0: if deployed and len(new_diff) > 0:
print("\n---------------------") print("\n---------------------")