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"