From e7de0ba826b9f1fa760042b514b195c211ad61ea Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 27 Jul 2026 10:58:13 +0800 Subject: [PATCH] =?UTF-8?q?Jenkins=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 981c3ce..2c330d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,15 +62,20 @@ pipeline { expression { return !params.SKIP_TEST } } // 在官方 Python 镜像里跑测试,避免污染宿主机;只装 dev extra,不装 browser + // 用 -u root 是因为 Jenkins 默认把容器用户映射到 jenkins uid,HOME=/, + // pip user-site 会解析到 /.local 直接报错;测试容器跑完即销毁,跑 root 无副作用 agent { docker { image 'registry.jerryyan.top/library/python:3.13-slim' reuseNode true + args '-u root:root' } } steps { sh ''' set -e + export HOME=/root + export PIP_CACHE_DIR=/root/.cache/pip # 阿里云 PyPI 镜像,UV_INDEX_URL 由 pipeline environment 注入 python -m pip install --quiet --upgrade pip -i "$UV_INDEX_URL" pip install --quiet uv -i "$UV_INDEX_URL"