fix: bound Gitea checkout latency
Deploy staging to test server / deploy (push) Failing after 7m40s

This commit is contained in:
linmeng
2026-07-28 17:25:44 +08:00
parent d81713527b
commit 56f0ee089b
3 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -29,7 +29,8 @@ jobs:
git init .
git remote remove origin 2>/dev/null || true
git remote add origin https://git.copse.top/root/Jyotisha.git
git fetch --no-tags origin "$GITEA_SHA"
git -c http.connectTimeout=15 -c http.lowSpeedLimit=1024 -c http.lowSpeedTime=30 \
fetch --depth=1 --no-tags origin "$GITEA_SHA"
git checkout --detach --force "$GITEA_SHA"
- name: Build and push images
+1 -1
View File
@@ -1577,7 +1577,7 @@
- 用户现象:staging 自动部署在构建 API 镜像时失败,阿里云 `library/python:3.12-slim` 返回 `pull access denied` / `insufficient_scope`;同路径的 Node 镜像也不可拉取。
- 触发条件:`staging` push 后,Runner 使用 `registry.cn-hangzhou.aliyuncs.com/library/python:3.12-slim` 或对应 Node 地址解析基础镜像。
- 根因:这两个阿里云 `library/*` 地址并非当前凭据可访问的公共镜像仓库;同时 xiaoxin 直连 Docker Hub 超时,导致不能简单换回官方短名称。
- 修复:工作流保持单 job 构建发布部署链路;API 基础镜像改为已在 xiaoxin 完整拉取验证的 DaoCloud Python 3.12 slimWeb 基础镜像改为已完整拉取验证的华为云 DDN Node 22 alpineAPI 构建使用实测最快的阿里云 PyPI 并设置 60 秒 pip 超时;远端 `ubuntu` 的 Docker 操作继续使用免交互 sudo。
- 修复:工作流保持单 job 构建发布部署链路;checkout 使用当前 SHA 的 depth-1 浅拉取并设置连接/低速超时;API 基础镜像改为已在 xiaoxin 完整拉取验证的 DaoCloud Python 3.12 slimWeb 基础镜像改为已完整拉取验证的华为云 DDN Node 22 alpineAPI 构建使用实测最快的阿里云 APT/PyPI 并设置有限重试与超时;远端 `ubuntu` 的 Docker 操作继续使用免交互 sudo。
- 验证:修复前两个阿里云基础镜像地址均返回拒绝,Docker Hub 超时;替代 Python/Node 基础镜像均在真实 Runner 主机完成整镜像 pull。首次修复运行实际阻塞在 Debian 官方 APT,后续 shell 命令尚未进入 pip;同机探测阿里云 Debian 索引约 0.11 秒/1.29 MB/s,清华约 0.30 秒/461 KB/s,官方约 1.22 秒/115 KB/s;阿里云 PyPI 也为候选中最快。后续构建、ACR push、服务器 Compose 和健康检查继续按运行日志闭环。
- 防复发:staging Dockerfile 的基础镜像必须在 xiaoxin 完整 `docker pull` 验证;APT 与 Python 包源均基于 Runner 实测选择并设置有限重试/超时,避免网络异常无限占用工作流。
- 相关记录:BUG-082、BUG-083、BUG-084
@@ -467,6 +467,8 @@ test("Gitea staging push builds ACR images and deploys them on the test server",
assert.match(workflow, /push:\n\s+branches: \[staging\]/);
assert.doesNotMatch(workflow, /pull_request:|workflow_dispatch:|needs: validate/);
assert.match(workflow, /crpi-d1feco6itet73spp\.cn-hongkong\.personal\.cr\.aliyuncs\.com\/copse\/jyotisha/);
assert.match(workflow, /fetch --depth=1 --no-tags origin "\$GITEA_SHA"/);
assert.match(workflow, /http\.lowSpeedTime=30/);
assert.match(workflow, /docker build .*railway-api\.Dockerfile/);
assert.match(workflow, /docker build .*railway-web\.Dockerfile/);
assert.match(workflow, /docker push "\$IMAGE_REPOSITORY:api-\$GITEA_SHA"/);