From 93abc85cff15c8a299f17ee2533618c696df7fd0 Mon Sep 17 00:00:00 2001 From: yuming Date: Sat, 4 Jul 2026 14:40:06 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=8D=A2=E5=9B=9E=20Debian=20=E6=BA=90?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=EF=BC=88runner=20=E5=AE=9E=E9=99=85=E6=98=AF?= =?UTF-8?q?=20Debian=2011=20=E4=B8=8D=E6=98=AF=20Ubuntu=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上次日志显示 gitea act_runner 用的 ubuntu-latest 底层是 Debian 11 bullseye,sources.list 里全是 deb.debian.org,我上一版 sed 只匹配 archive.ubuntu.com,一行都没换。 修正: - sed 匹配 deb.debian.org / security.debian.org,换到阿里云 - Ubuntu 源规则保留兼容(万一以后 runner 镜像换) - 拿到诊断日志后清理详细输出,恢复静默 Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/deploy.yml | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index f16aa3c..4551ce3 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -14,30 +14,15 @@ jobs: echo "Docker 已预装:$(docker --version)" exit 0 fi - echo "=== 1. 系统信息 ===" - cat /etc/os-release | head -5 || true - echo "" - echo "=== 2. 换源前 sources 文件 ===" - ls -la /etc/apt/sources.list /etc/apt/sources.list.d/ 2>&1 || true - grep -h -E 'ubuntu|debian|http' /etc/apt/sources.list /etc/apt/sources.list.d/*.sources /etc/apt/sources.list.d/*.list 2>/dev/null | grep -v '^#' | head -10 || true - echo "" - echo "=== 3. 换源到阿里云 ===" + echo "Docker 未预装,换 apt 源到阿里云再安装(gitea act_runner 实际是 Debian 11)" + # Debian 源(当前 runner 实际用的) + sed -i 's|deb.debian.org|mirrors.aliyun.com|g;s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list 2>/dev/null || true + sed -i 's|deb.debian.org|mirrors.aliyun.com|g;s|security.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/*.list 2>/dev/null || true + # Ubuntu 源兼容(万一以后 runner 镜像换成 Ubuntu) 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 - echo "--- 换源后 sources 内容:" - grep -h -E 'aliyun|ubuntu|debian|http' /etc/apt/sources.list /etc/apt/sources.list.d/*.sources /etc/apt/sources.list.d/*.list 2>/dev/null | grep -v '^#' | head -10 || true - echo "" - echo "=== 4. 网络探测 ===" - echo "--- DNS 解析 mirrors.aliyun.com:" - timeout 5 getent hosts mirrors.aliyun.com || echo "DNS 解析失败" - echo "--- HTTP 探测 mirrors.aliyun.com:" - timeout 10 curl -s -o /dev/null -w "http_code=%{http_code} time=%{time_total}s\n" http://mirrors.aliyun.com/ || echo "curl 阿里云失败" - echo "" - echo "=== 5. apt-get update ===" - timeout 90 apt-get update || { echo "apt-get update 失败,看上面日志定位"; exit 1; } - echo "=== 6. 安装 docker.io ===" - timeout 240 apt-get install -y docker.io || { echo "docker.io 安装超时"; exit 1; } + 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: 拉取代码