test(ci): 刀3 — CI 单点韧性:runner 离线告警(缺口③)
ci-pangolin / Lint — shellcheck (pull_request) Successful in 9s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 23s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 5s
ci-pangolin / Flutter — analyze + test (pull_request) Failing after 37s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 6s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / Go — build + test (pull_request) Successful in 19s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Successful in 17s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Successful in 4m16s
ci-pangolin / Golden — 视觉回归 (components + auth) (pull_request) Successful in 15s
ci-pangolin / Lint — shellcheck (push) Successful in 5s
ci-pangolin / OpenAPI Sync Check (push) Successful in 23s
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (push) Successful in 6s
ci-pangolin / Flutter — analyze + test (push) Failing after 15s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (push) Successful in 5s
ci-pangolin / Codegen Drift — token 生成物未漂移 (push) Successful in 5s
ci-pangolin / Go — build + test (push) Successful in 7s
ci-pangolin / E2E Smoke — L4 进程级端到端 (push) Successful in 19s
ci-pangolin / Go — integration (mysql/redis testcontainers) (push) Failing after 4m29s
ci-pangolin / Golden — 视觉回归 (components + auth) (push) Successful in 13s

CI 整条吊在一台 mac,关机/掉线即全停且无人知道。新增
deploy/runner/runner-deadman.sh(仿 bootstrap/monitor/deadman-watch.sh):
放另一台常在线主机,每 3 分钟查 gitea Actions API 里 mac-pangolin-2 的 status,
连续 offline 到阈值 → Telegram 告警,恢复也通知;API 取不到时跳过不误报。

响应字段已对照真 gitea API 核验({"runners":[{"name":...,"status":"online"}]}),
shellcheck 干净,实跑验证 online→不告警、缺失→进告警分支。

docs/ci-runner.md 增「韧性」节(告警部署 + cron/launchd)并标注持久化激活仍待
本机手动跑(pkill/launchctl,Claude 跑不了);验证段 job 数 9→10。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-25 23:04:35 +08:00
parent 75cdbf583f
commit e7b37d7719
3 changed files with 99 additions and 2 deletions
+25 -1
View File
@@ -57,6 +57,30 @@ launchctl load ~/Library/LaunchAgents/com.pangolin.act-runner.plist
> 依赖 jiu 的 relay(13000)常驻:jiu 的 `com.jiu.act-runner` 在 → relay 在 → 本 runner 能连 NAS gitea。
> ⚠️ **持久化激活状态**:上面三条一次性命令含 `pkill`/`launchctl`,需在 mac 本机手动执行
> (Claude 跑不了)。未激活前 runner 是临时 daemon,mac 重启即停。激活后用下面的离线告警兜底。
## 韧性:runner 离线告警(单点兜底)
CI 整条吊在这一台 mac 上,mac 关机/掉线 → CI 全停且**无人知道**。脚本
`deploy/runner/runner-deadman.sh`(仿 `bootstrap/monitor/deadman-watch.sh`)放在**另一台
常在线主机**上,每 3 分钟查 gitea Actions API 里 `mac-pangolin-2``status`,连续
offline 到阈值 → Telegram 告警,恢复也通知;API 取不到时跳过不误报。
**部署**(在常在线主机,如 jiu 的 mac / NAS):
```bash
cp deploy/runner/runner-deadman.sh /usr/local/bin/ && chmod +x /usr/local/bin/runner-deadman
# /etc/pangolin-runner-deadman.env(不入 git):
# GITEA_URL=http://127.0.0.1:13000 GITEA_TOKEN=<Bitwarden「gitea 读写key」>
# GITEA_REPO=wangjia/pangolin RUNNER_NAME=mac-pangolin-2
# TELEGRAM_BOT_TOKEN=... TELEGRAM_CHAT_ID=... FAIL_THRESHOLD=2
# cron(每 3 分钟):
echo '*/3 * * * * /usr/local/bin/runner-deadman >/dev/null 2>&1' | crontab -
```
mac 宿主可改 launchd LaunchAgent`StartInterval` 180 + 同一脚本),仿
`com.pangolin.act-runner.plist`。响应字段已对照真 API 核验:
`{"runners":[{"name":"mac-pangolin-2","status":"online",...}]}`
## 已删除:mac-pangolin(第一次注册的,id 5)
第一次注册的 runner(label `nas`,config `~/.act_runner_pangolin_config.yaml`)。job 调试时已从 **gitea 删除注册**(API DELETE,204)。本机残留待清:
```bash
@@ -69,4 +93,4 @@ rm -rf ~/.cache/act-pangolin
## 验证
- gitea → 仓库 Settings → Actions → Runners 应只见 **mac-pangolin-2**(online)。
-`main` 开 PR 触发 9 个 job;首次全绿见 run #298(commit `65bd7c3`)。
-`main` 开 PR 触发 10 个 job(后增覆盖率闸 + go-integration);首次全绿见 run #298(commit `65bd7c3`)。
+1 -1
View File
@@ -122,7 +122,7 @@
<h2>排障 / Runbook</h2>
<a class="doc" href="ci-runner.md">
<div class="t">CI Runner 设置记录 <span class="tag md">MD</span></div>
<div class="d">gitea Actions self-hosted runner 记录:决定用 1 个(mac-pangolin-2,项目级·mac host·label nas·复用 jiu relay)、已删 orphan 的清理命令、持久化 TODO。CI 首跑 run #298 9/9 全绿</div>
<div class="d">gitea Actions self-hosted runner 记录:决定用 1 个(mac-pangolin-2,项目级·mac host·label nas·复用 jiu relay)、已删 orphan 的清理命令、launchd 持久化 + 单点韧性(runner 离线 Telegram 告警)。CI 首跑 run #298。</div>
<div class="path">docs/ci-runner.md</div>
</a>
<a class="doc" href="macos-sysext-realize-troubleshooting.html">