我还有另一个问题,即通过 Jenkins 声明性管道运行 Docker 的权限。我想通过 Docker 容器中的 Jenkins 作业构建和发布 Python 包:
pipeline {
agent {
docker {
image 'python:3.7'
label 'docker && linux'
}
}
environment {
PACKAGE_VERSION = readFile 'VERSION'
}
stages {
stage('Package') {
steps {
sh 'python -V'
sh 'python -m pip install -r requirements.txt --user --no-cache'
sh 'python setup.py sdist'
}
}
stage('Deploy') {
steps {
...
}
}
}
post {
always {
cleanWs()
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,pip install由于以下原因,我不允许PermissionError: …