[DEPLOY] Сверка учитывает значения образа, когда compose их не переопределяет (CT140: 0)
lint / hygiene (push) Successful in 16s
lint / hygiene (push) Successful in 16s
This commit is contained in:
1 parent
66251e4a89
commit
cc677489c1
1 file changed
+21
-3
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user