那是我的詹金斯文件.
pipeline {
agent none
stages {
stage('Build') {
agent {
docker {
image 'python:3-alpine'
}
}
steps {
sh 'pip install --user -r requirements.txt'
sh 'python WebChecker.py'
}
post {
always {
junit 'output.xml'
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我在詹金斯运行时,我得到了跟随
[urltester] Running shell script
+ pip install --user -r requirements.txt
The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. …Run Code Online (Sandbox Code Playgroud) 我有这个Dockerfile:
FROM python:3.7
CMD ["/bin/bash"]
Run Code Online (Sandbox Code Playgroud)
和这个Jenkinsfile:
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
}
}
stages {
stage('Install') {
steps {
sh 'pip install --upgrade pip'
}
}
}
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误:
The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/.cache/pip' or its …Run Code Online (Sandbox Code Playgroud) 我在jenkins中有sh脚本,它有sudo ssh命令,我收到了这个错误
Warning: Identity file key.pem not accessible: Permission denied.
Host key verification failed.
sudo: no tty present and no askpass program specified
Run Code Online (Sandbox Code Playgroud)
我找到了添加的解决方案
jenkins ALL=(ALL) ALL
Run Code Online (Sandbox Code Playgroud)
/ etc/sudoers中的这些行仍然无法正常工作.