docs: 修正 CI 缓存放行网段与日志级别说明

This commit is contained in:
que01 committed 2026-10-21 14:14:04 +08:00
1 parent 261a33a5ca
commit 658c94a4e9
1 file changed
+25 -3
+25 -3
View File
@@ -33,13 +33,25 @@ Runner 与生产 API 共用 `oracle_arm` 主机。任务容器已限制 CPU 与
Runner 内置 cache server(`cache.host=172.17.0.1`、`cache.port=8193`、`cache.dir=/home/ubuntu/gitea-runner/cache-data`),供 `actions/setup-node` 的 pnpm 缓存使用。
任务容器通过 Docker bridge 网关 `172.17.0.1` 访问该端口,因此需要在主机放行容器网段:
任务容器与主机之间被 `ufw` 的 `INPUT DROP` 默认策略拦截,需要显式放行 Docker 使用的三个私网网段:
```bash
sudo ufw allow from 172.16.0.0/12 to any port 8193 proto tcp comment "gitea actions cache"
sudo ufw allow from 192.168.0.0/16 to any port 8193 proto tcp comment "gitea actions cache"
sudo ufw allow from 10.0.0.0/8 to any port 8193 proto tcp comment "gitea actions cache"
```
未放行时表现为 `Failed to GetCacheEntryDownloadURL ... ETIMEDOUT`,每个 job 会额外空等数分钟,且缓存永远不会命中。
注意 Gitea Actions 会为每个 job 建立自己的 bridge 网络(实测网关为 `192.168.80.1`),不只是默认的 `172.17.0.1`;只放行 `172.16.0.0/12` 仍然会超时。
未放行时表现为 `Failed to GetCacheEntryDownloadURL ... ETIMEDOUT`,每个 job 会额外空等数分钟,且缓存永远不会命中。验证方式是在 job 容器内直接请求缓存端口:
```bash
docker exec <job-container> node -e 'fetch("http://172.17.0.1:8193/").then(r=>console.log(r.status))'
```
返回 `404` 表示连通(该端口不提供根路径),超时表示仍被拦截。
Runner 日志级别保持 `debug`:`info` 级别不会记录各 step 的 `Success - Main ...` 与告警,排障时只能依赖 Gitea 页面。
## 首次完整通过
@@ -53,4 +65,14 @@ sudo ufw allow from 172.16.0.0/12 to any port 8193 proto tcp comment "gitea acti
单并发下整轮约 33 分钟;三个 job 串行执行,主要耗时在 `pnpm install` 与构建。
该轮次全部告警均来自缓存后端不可达(`ETIMEDOUT`),已按上一节修复;修复后的命中情况在下一次 run 中确认。
该轮次全部告警均来自缓存后端不可达(`ETIMEDOUT`),已按上一节修复。
修复后的对照数据(run `22`,commit `261a33a`):
| job | 修复前耗时 | 修复后耗时 |
| ---------------- | ---------- | --------------------------------------------------------- |
| Static checks | 11.8 min | 11.7 min(该 job 在放行规则生效前启动,仍走缓存超时路径) |
| Production build | 11.7 min | 7.6 min |
| API integration | 9.7 min | 3.8 min |
缓存内容为 pnpm store,首次落盘约 268 MB,位于 `/home/ubuntu/gitea-runner/cache-data`。