From cc677489c1f7d8cad356397a2a6094369f90f9b7 Mon Sep 17 00:00:00 2001 From: Roman Buryan Date: Wed, 28 Oct 2026 14:06:40 +0300 Subject: [PATCH] =?UTF-8?q?[DEPLOY]=20=D0=A1=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= =?UTF-8?q?=20=D1=83=D1=87=D0=B8=D1=82=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B0,=20=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20co?= =?UTF-8?q?mpose=20=D0=B8=D1=85=20=D0=BD=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D1=8F=D0=B5=D1=82=20?= =?UTF-8?q?(CT140:=200)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/scripts/check-compose-parity.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ops/scripts/check-compose-parity.py b/ops/scripts/check-compose-parity.py index bb932e4..6bbbc66 100755 --- a/ops/scripts/check-compose-parity.py +++ b/ops/scripts/check-compose-parity.py @@ -45,6 +45,16 @@ def live(ct): return out +def image_default(ct, image): + """entrypoint/cmd, которые Docker возьмёт из образа, если compose молчит.""" + r = pct(ct, "docker", "image", "inspect", image, "-f", "{{json .Config.Entrypoint}} {{json .Config.Cmd}}") + try: + ep, cmd = r.stdout.strip().split(" ", 1) + return json.loads(ep), json.loads(cmd) + except Exception: + return None, None + + def wanted(ct): p = f"{REPO}/deploy/ct{ct}/docker-compose.yml" if not os.path.exists(p): @@ -75,9 +85,17 @@ def main(): print(f"{name}: контейнера нет (будет создан)") continue for field in ("image", "entrypoint", "cmd"): - if w.get(field) != l.get(field): - print(f"{name}.{field}: compose={w.get(field)} живой={l.get(field)}") - problems += 1 + wv, lv = w.get(field), l.get(field) + if wv == lv: + continue + if wv is None: + # compose не переопределяет — значит действует значение образа + ep, cmd = image_default(ct, w.get("image") or lv and l.get("image")) + default = ep if field == "entrypoint" else cmd + if lv == default: + continue + print(f"{name}.{field}: compose={wv} живой={lv}") + problems += 1 if w.get("env") and l.get("env"): missing = set(w["env"]) - set(l["env"]) if missing: