mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 21:02:12 +03:00
Adds the on-demand self-hosted runner plumbing for /generate-release: - scripts/vps/release-runner-up.sh: starts the runner VM on Proxmox, waits for >=1 'omni-release' runner to report online via the GitHub API, then flips the USE_VPS_RUNNER repo variable to true. Any failure/timeout sets it back to false and exits 1 so the caller falls back to hosted runners. - scripts/vps/release-runner-down.sh: flips USE_VPS_RUNNER=false FIRST (so no job gets scheduled onto a dying runner), then gracefully shuts the VM down. Idempotent. - ci.yml: build, test-unit x8 and test-vitest pick their runner dynamically. Self-hosted is used ONLY when USE_VPS_RUNNER == 'true' AND the event is own-origin (push/dispatch, or a PR whose head repo is this repository). Fork PRs and the var's default/absent state always fall back to ubuntu-latest. Why: the Free plan caps hosted concurrency at 20 jobs; a release run saturates it and queues. The benchmarked VPS (32-core, 4 runners) matches hosted per-job times (unit ~8.5min/shard, build 9min turbo) but eliminates the queue, which is the real release bottleneck (~30-50min on a busy day). Scope is conservative: only the three job families benchmarked on the VPS; e2e/electron/integration stay hosted (playwright/xvfb provisioning not validated on the runner workspace yet).
23 lines
1019 B
Bash
Executable File
23 lines
1019 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Desliga a VM self-hosted (VPS 113) ao fim do release e volta o CI para o GitHub-hosted.
|
|
# Idempotente: seguro chamar mesmo que a VM já esteja desligada.
|
|
#
|
|
# Uso: scripts/vps/release-runner-down.sh
|
|
set -uo pipefail
|
|
|
|
PVE_HOST="${PVE_HOST:-192.168.0.100}"
|
|
VM_ID="${VM_ID:-113}"
|
|
REPO="${REPO:-diegosouzapw/OmniRoute}"
|
|
SSH="ssh -o BatchMode=yes -o ConnectTimeout=8"
|
|
|
|
# 1) Volta o CI para ubuntu-latest ANTES de derrubar a VM (evita jobs presos).
|
|
echo "[release-runner] USE_VPS_RUNNER=false (CI volta ao GitHub-hosted)."
|
|
gh variable set USE_VPS_RUNNER --repo "$REPO" --body "false" >/dev/null 2>&1 || true
|
|
|
|
# 2) Shutdown graceful da VM (libera os 32 cores / 24GB de volta ao host).
|
|
echo "[release-runner] desligando VM $VM_ID (graceful)..."
|
|
$SSH "root@$PVE_HOST" "qm shutdown $VM_ID --timeout 120" 2>/dev/null \
|
|
|| $SSH "root@$PVE_HOST" "qm stop $VM_ID" 2>/dev/null \
|
|
|| echo "[release-runner] ⚠️ não consegui desligar a VM $VM_ID — verifique manualmente."
|
|
echo "[release-runner] pronto."
|