摆脱詹金斯管道中的奇怪错误
[Pipeline] withDockerContainer acp-ci-ubuntu-test does not seem to be running inside a container $ docker run -t -d -u 1002:1006 -u ubuntu --net=host -v /var/run/docker.sock:/var/run/docker.sock -v /home/ubuntu/.docker:/home/ubuntu/.docker -w /home/ubuntu/workspace/CD-acp-cassandra -v /home/ubuntu/workspace/CD-acp-cassandra:/home/ubuntu/workspace/CD-acp-cassandra:rw,z -v /home/ubuntu/workspace/CD-acp-cassandra@tmp:/home/ubuntu/workspace/CD-acp-cassandra@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** quay.io/arubadevops/acp-build:ut-build cat $ docker top 83d04d0a3a3f9785bdde3932f55dee36c079147eb655c1ee9d14f5b542f8fb44 -eo pid,comm [Pipeline] { [Pipeline] sh process apparently never started in /home/ubuntu/workspace/CD-acp-cassandra@tmp/durable-70b242d1 (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer) [Pipeline] } $ docker stop --time=1 83d04d0a3a3f9785bdde3932f55dee36c079147eb655c1ee9d14f5b542f8fb44 $ docker rm -f 83d04d0a3a3f9785bdde3932f55dee36c079147eb655c1ee9d14f5b542f8fb44 [Pipeline] // withDockerContainer
詹金斯管道的相应阶段是
stage("Build docker containers & coreupdate packages") { agent { docker { image "quay.io/arubadevops/acp-build:ut-build" label "acp-ci-ubuntu" args "-u ubuntu --net=host -v /var/run/docker.sock:/var/run/docker.sock -v $HOME/.docker:/home/ubuntu/.docker" } } steps { script { try { sh "export CI_BUILD_NUMBER=${currentBuild.number}; cd docker; ./build.sh; cd ../test; ./build.sh;" ciBuildStatus="PASSED" } catch (err) { ciBuildStatus="FAILED" } } } }
为何无法在Docker容器中启动进程是什么原因?关于如何进一步调试的任何指示也很有帮助。
该问题是由Jenkins持久任务插件v1.31中引入的一些重大更改引起的。
资源:
https://issues.jenkins-ci.org/browse/JENKINS-59907和 https://github.com/jenkinsci/durable-task- plugin/blob/master/CHANGELOG.md
解决方案:将Jenkins持久任务插件升级到v1.33为我们解决了该问题。