fix(acceptance): 复用集群 SSH 控制连接

线上验收在宁波 SSH 建连超时时于负载前失败。为集群脚本增加受限 ControlMaster 复用和仅建连阶段的 ConnectionAttempts,避免重放远程命令。\n\n生产快照导出增加三次只读重试、原子落盘和空 Pod 清理防护。已通过 bash -n、ShellCheck、production acceptance 脚本测试、人工发布脚本测试,并验证宁波真实 SSH 控制连接可复用。
This commit is contained in:
2026-08-01 15:59:00 +08:00
parent 8ca3e2dbc2
commit 7623449e33
3 changed files with 52 additions and 3 deletions
@@ -7,6 +7,21 @@ tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
script=$root/scripts/cluster/run-production-acceptance.sh
# shellcheck source=scripts/cluster/common.sh
source "$root/scripts/cluster/common.sh"
ssh() {
printf '%s\n' "$@" >"$tmp/ssh-arguments"
}
cluster_ssh_key=$tmp/test-key
cluster_ssh_control_dir=$tmp/ssh-control
cluster_ssh root@cluster.invalid true
grep -Fxq 'ConnectionAttempts=3' "$tmp/ssh-arguments"
grep -Fxq 'ControlMaster=auto' "$tmp/ssh-arguments"
grep -Fxq 'ControlPersist=120' "$tmp/ssh-arguments"
grep -Fxq "ControlPath=$cluster_ssh_control_dir/%C" "$tmp/ssh-arguments"
[[ $(stat -f '%Lp' "$cluster_ssh_control_dir") == 700 ]]
awk '
/^is_release_ancestor\(\)/ { capture = 1 }
capture && /^create_and_activate_run\(\)/ { exit }