From f1068f2e03d8371a6859c3a48ceaf051ee766025 Mon Sep 17 00:00:00 2001 From: Filippo Ledda Date: Mon, 15 Jan 2024 19:08:15 +0100 Subject: [PATCH] Fix tests --- tools/deployment-cli-tools/ch_cli_tools/skaffold.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/deployment-cli-tools/ch_cli_tools/skaffold.py b/tools/deployment-cli-tools/ch_cli_tools/skaffold.py index 774234b9..c0de5764 100644 --- a/tools/deployment-cli-tools/ch_cli_tools/skaffold.py +++ b/tools/deployment-cli-tools/ch_cli_tools/skaffold.py @@ -143,7 +143,8 @@ def process_build_dockerfile(dockerfile_path, root_path, global_context=False, r def identify_unicorn_based_main(candidates): import re gunicorn_pattern = re.compile(r"gunicorn") - for candidate in candidates: + # sort candidates, shortest path first + for candidate in sorted(candidates,key=lambda x: len(x.split("/"))): dockerfile_path = f"{candidate}/.." while not exists(f"{dockerfile_path}/Dockerfile") and abspath(dockerfile_path) != abspath(root_path): dockerfile_path += "/.."