我目前在 Ubuntu 18.04 上运行 Jenkins 时遇到问题。sh 管道步骤挂起并最终超时并显示以下消息:
[Pipeline] sh
process apparently never started in /var/lib/jenkins/workspace/members-only-demo@tmp/durable-494a3b0d
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
Cannot contact : java.io.FileNotFoundException: File '/var/lib/jenkins/workspace/members-only-demo@tmp/durable-494a3b0d/output.txt' does not exist
这是线程转储:
Thread #6
at DSL.sh(completed process (code -2) in /var/lib/jenkins/workspace/members-only-demo@tmp/durable-494a3b0d; recurrence period: 15000ms; check task scheduled; cancelled? false done? false)
at WorkflowScript.run(WorkflowScript:9)
at DSL.stage(Native Method)
at WorkflowScript.run(WorkflowScript:8)
at DSL.node(running on )
at WorkflowScript.run(WorkflowScript:3)
流水线脚本如下:
#!/usr/bin/env groovy
node {
stage('Checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/da-demo']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'TeamHub2', url: '[email protected]:digitalarchitects/projects/slender-man/repositories/git/members-only-app']]])
}
stage('Create Build Dir') {
sh label: '', returnStdout: true, script: 'rm --recursive --force ${env.WORKSPACE}/build/'
sh 'mkdir --parents ${env.WORKSPACE}/build/coverage ${env.WORKSPACE}/build/logs ${env.WORKSPACE}/build/pdepend'
}
...
}
我不太确定如何解决此问题。有人可以帮忙吗?
在插件更新与 Jenkins k8s 节点出现相同问题后,默认 jnlp k8s 节点的默认 workingDir 值现在设置为
/home/jenkins/agent
,而对于 pod 中的第二个容器,我将其设置为/home/jenkins
。将 workingDir 切换到
/home/jenkins/agent
pod 中的第二个容器解决了这个问题。我最终使用 apt-get --purge remove jenkins 然后 apt-get install jenkins 重新安装了 jenkins。可悲的是,一切都必须重新配置,但问题已经解决。
我遇到过同样的问题。这是由于 kubernetes pod 安全策略。放宽豆荚政策后就可以了。