fix(cd): decouple executor boundary from endpoint outage

This commit is contained in:
ogt
2026-07-14 10:42:53 +08:00
parent 0daadd31c7
commit 708f976275
2 changed files with 13 additions and 9 deletions

View File

@@ -2879,7 +2879,7 @@ jobs:
connected = []
refused = []
permitted = []
unavailable = []
for host in sys.argv[1:]:
try:
connection = socket.create_connection((host, 22), timeout=1.0)
@@ -2890,23 +2890,25 @@ jobs:
# verifier; a stopped sshd must not make a healthy rollout
# look like a policy failure.
refused.append(host)
permitted.append(host)
except OSError:
continue
# Endpoint availability is a separate runtime signal. The
# exact five-destination NetworkPolicy allowlist above is
# the source of truth for the security boundary; one down
# host must not roll back all healthy workloads.
unavailable.append(host)
else:
connection.close()
connected.append(host)
permitted.append(host)
print("broker_ssh_connected=" + ",".join(connected))
print(
"broker_ssh_refused_but_egress_permitted="
+ ",".join(refused)
)
raise SystemExit(
0
if connected and len(permitted) == len(sys.argv) - 1
else 1
print(
"broker_ssh_allowlisted_endpoint_unavailable="
+ ",".join(unavailable)
)
raise SystemExit(0 if connected else 1)
PY
}
verify_ssh_denied awoooi-api api || {

View File

@@ -120,5 +120,7 @@ def test_cd_applies_rolls_back_and_verifies_network_boundary() -> None:
assert workflow.count(expected_hosts) >= 4
assert "except ConnectionRefusedError:" in workflow
assert "broker_ssh_refused_but_egress_permitted=" in workflow
assert "connected and len(permitted) == len(sys.argv) - 1" in workflow
assert "broker_ssh_allowlisted_endpoint_unavailable=" in workflow
assert "raise SystemExit(0 if connected else 1)" in workflow
assert "len(permitted) == len(sys.argv) - 1" not in workflow
assert "ssh-mcp-key known_hosts 更新失敗,停止部署" in workflow