Tighten MEV rollout verification and deploy timeouts
All checks were successful
Deploy to Phoenix / deploy (push) Successful in 11s

This commit is contained in:
defiQUG
2026-04-14 17:19:50 -07:00
parent c281c67a79
commit cba978f656
3 changed files with 37 additions and 8 deletions

View File

@@ -8,6 +8,10 @@ MEV_DIR="${MEV_BACKEND_MEV_DIR:-$CT_ROOT/mev-platform}"
MEV_BRANCH="${MEV_BACKEND_BRANCH:-master}"
PARENT_BRANCH="${MEV_BACKEND_PARENT_BRANCH:-master}"
API_KEY="${MEV_API_KEY:-}"
SSH_CONNECT_TIMEOUT="${MEV_BACKEND_SSH_CONNECT_TIMEOUT:-10}"
SSH_SERVER_ALIVE_INTERVAL="${MEV_BACKEND_SSH_SERVER_ALIVE_INTERVAL:-10}"
SSH_SERVER_ALIVE_COUNT_MAX="${MEV_BACKEND_SSH_SERVER_ALIVE_COUNT_MAX:-6}"
REMOTE_TIMEOUT_SECONDS="${MEV_BACKEND_REMOTE_TIMEOUT_SECONDS:-1800}"
APPLY=0
usage() {
@@ -27,6 +31,7 @@ Options:
--branch NAME mev-platform branch to fast-forward (default: master)
--parent-branch NAME MEV_Bot branch to fast-forward (default: master)
--api-key KEY Optional API key for protected verification routes
--remote-timeout SEC Max remote execution time before timeout (default: 1800)
--dry-run Print the planned remote command (default behavior)
--apply Execute the deployment
-h, --help Show this help
@@ -63,6 +68,10 @@ while [[ $# -gt 0 ]]; do
API_KEY="$2"
shift 2
;;
--remote-timeout)
REMOTE_TIMEOUT_SECONDS="$2"
shift 2
;;
--dry-run)
APPLY=0
shift
@@ -95,6 +104,8 @@ require_cmd bash
REMOTE_CMD=$(cat <<EOF
set -euo pipefail
command -v timeout >/dev/null 2>&1 || { echo "missing timeout inside CT" >&2; exit 127; }
timeout ${REMOTE_TIMEOUT_SECONDS}s bash -lc '
cd "$CT_ROOT"
echo "== parent repo =="
git fetch origin
@@ -133,6 +144,7 @@ if [ -n "${API_KEY}" ]; then
curl -fsS -H "X-API-Key: ${API_KEY}" http://127.0.0.1:9090/api/stats/metrics-surfaces
echo
fi
'
EOF
)
@@ -143,10 +155,12 @@ echo "CT root: $CT_ROOT"
echo "MEV dir: $MEV_DIR"
echo "Parent branch: $PARENT_BRANCH"
echo "MEV branch: $MEV_BRANCH"
echo "SSH timeout: ${SSH_CONNECT_TIMEOUT}s connect, ${SSH_SERVER_ALIVE_INTERVAL}s keepalive x ${SSH_SERVER_ALIVE_COUNT_MAX}"
echo "Remote limit: ${REMOTE_TIMEOUT_SECONDS}s"
echo "Apply: $APPLY"
echo
echo "Planned remote command:"
echo "ssh root@$PVE_HOST \"pct exec $CT_VMID -- bash -lc $(printf '%q' "$REMOTE_CMD")\""
echo "ssh -o BatchMode=yes -o ConnectTimeout=$SSH_CONNECT_TIMEOUT -o ServerAliveInterval=$SSH_SERVER_ALIVE_INTERVAL -o ServerAliveCountMax=$SSH_SERVER_ALIVE_COUNT_MAX root@$PVE_HOST \"pct exec $CT_VMID -- bash -lc $(printf '%q' "$REMOTE_CMD")\""
if [[ "$APPLY" -ne 1 ]]; then
echo
@@ -154,4 +168,10 @@ if [[ "$APPLY" -ne 1 ]]; then
exit 0
fi
ssh "root@$PVE_HOST" "pct exec $CT_VMID -- bash -lc $(printf '%q' "$REMOTE_CMD")"
ssh \
-o BatchMode=yes \
-o ConnectTimeout="$SSH_CONNECT_TIMEOUT" \
-o ServerAliveInterval="$SSH_SERVER_ALIVE_INTERVAL" \
-o ServerAliveCountMax="$SSH_SERVER_ALIVE_COUNT_MAX" \
"root@$PVE_HOST" \
"pct exec $CT_VMID -- bash -lc $(printf '%q' "$REMOTE_CMD")"