From 9038c39afade0eaa679b4332e095ea2ac24187d7 Mon Sep 17 00:00:00 2001 From: yuming Date: Sat, 4 Jul 2026 14:28:12 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=8D=A2=20runner=20=E5=86=85=20Ubuntu?= =?UTF-8?q?=20apt=20=E6=BA=90=E5=88=B0=E9=98=BF=E9=87=8C=E4=BA=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上次跑到 apt-get update 60s 超时(timeout 兜底生效)。原因: - Runner (ubuntu-latest) 用的是 archive.ubuntu.com / security.ubuntu.com - 之前的 sed 只匹配 deb.debian.org,对 Ubuntu 源根本没换 修改: - 换 Ubuntu 源到 mirrors.aliyun.com,兼容 legacy /etc/apt/sources.list、 deb822 .sources 和 sources.list.d/*.list 三种格式 - update timeout 60s → 90s,install 180s → 240s,给国内源一点余量 Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/deploy.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index b9bc7e3..9f6e811 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -10,14 +10,18 @@ jobs: steps: - name: 安装 Docker CLI run: | - # 大概率 gitea act_runner 已预装 docker,先探测(避免 apt 走国外源 3h 超时) + # 大概率 gitea act_runner 已预装 docker,先探测(避免 apt 走国外源超时) if command -v docker >/dev/null 2>&1; then echo "Docker 已预装:$(docker --version)" exit 0 fi - echo "Docker 未预装,开始 apt 安装(每步限时 3 分钟,超时快速失败)" - timeout 60 apt-get update -qq || { echo "apt-get update 超时/失败"; exit 1; } - timeout 180 apt-get install -y -qq docker.io || { echo "docker.io 安装超时/失败"; exit 1; } + echo "Docker 未预装,换 Ubuntu 源到阿里云再 apt 安装" + # 兼容 legacy sources.list、deb822 .sources、以及 sources.list.d/*.list + sed -i 's|archive.ubuntu.com|mirrors.aliyun.com|g;s|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true + sed -i 's|archive.ubuntu.com|mirrors.aliyun.com|g;s|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/*.sources 2>/dev/null || true + sed -i 's|archive.ubuntu.com|mirrors.aliyun.com|g;s|security.ubuntu.com|mirrors.aliyun.com|g' /etc/apt/sources.list.d/*.list 2>/dev/null || true + timeout 90 apt-get update -qq || { echo "apt-get update 超时/失败"; exit 1; } + timeout 240 apt-get install -y -qq docker.io || { echo "docker.io 安装超时/失败"; exit 1; } docker --version - name: 拉取代码