我最近升级了我的jenkins / Docker安装,因为当我在我的jenkins管道脚本中运行一个docker时,我会随机经历超时,我在其中启动了一个像这样的docker:
docker.image("${dockerImage}").inside(' -v /opt/software/:/software/:Z'){
.....
}
这是随机发生的,我的作业崩溃时出现以下错误消息(请参阅此主题底部的扩展日志):
ERROR: Timeout after 10 seconds
更新 我的管道脚本:
stage('Build'){
node("master"){
withEnv(['GIT_SSL_NO_VERIFY=true']){
checkout([$class: 'GitSCM', branches: [[name: "$myGitSHA"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId:"${myGitCredentialsId}" , url:"${myGitUrl}" ]]])
}
docker.image("${dockerImage}").inside(' -v /opt/software/:/software/:Z'){
// Cleaning any the previous build
sh "make all"
} // docker
} // node
} // stage
我想知道是否有一个选项可以将当前设置的默认超时值增加到10秒。
感谢
$ docker run -t -d -u 995:993 -v /opt/software/:/software/:Z -w /var/lib/jenkins/jobs/RegressionTests/jobs/rg_centos5-x86_64-gcc-4.1.2/workspace
-v /var/lib/jenkins/jobs/RegressionTests/jobs/rg_centos5-x86_64-gcc-4.1.2/workspace:/var/lib/jenkins/jobs/RegressionTests/jobs/rg_centos5-x86_64-gcc-4.1.2/workspace:rw
-v /var/lib/jenkins/jobs/RegressionTests/jobs/rg_centos5-x86_64-gcc-4.1.2/workspace@tmp:/var/lib/jenkins/jobs/RegressionTests/jobs/rg_centos5-x86_64-gcc-4.1.2/workspace@tmp:rw
-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 ******** --entrypoint cat centos5_labs_ompi14
ERROR: Timeout after 10 seconds
java.io.IOException: Failed to run image 'centos5_labs_ompi14'. Error:
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.run(DockerClient.java:127)
at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:178)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:184)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:126)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(jar:file:/var/lib/jenkins/plugins/docker-workflow/WEB-INF/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/Docker.groovy:128)
at org.jenkinsci.plugins.docker.workflow.Docker.node(jar:file:/var/lib/jenkins/plugins/docker-workflow/WEB-INF/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/Docker.groovy:63)
at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(jar:file:/var/lib/jenkins/plugins/docker-workflow/WEB-INF/lib/docker-workflow.jar!/org/jenkinsci/plugins/docker/workflow/Docker.groovy:116)
at Script1.extMain(Script1.groovy:305)
at ___cps.transform___(Native Method)
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
at sun.reflect.GeneratedMethodAccessor349.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
at com.cloudbees.groovy.cps.Next.step(Next.java:74)
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:165)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:3)
问题是由于硬编码的10s超时值,因为可以从此链接读取它; docker workflow plugin https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L268
在某些情况下,这太短了。解决方案是将此超时值作为由用户设置的参数。
答案 1 :(得分:0)
我从昨天起也遇到了同样的问题。我的docker管道版本是1.10。
尝试从fol
启动docker容器时会出现问题def abcd_image = docker.image('172.16.181.203:5000/abcd:1.0.0.7')
abcd_image.inside("--privileged -u root -v ${actual_workspace}:${chroot}/code") {
我尝试将ssh插入docker主机并重启docker服务。在那之后,它可以工作,但问题会在几个小时后回来。
答案 2 :(得分:0)
您可以使用" timeout"手动设置超时限制。选项。
设置Pipeline运行的超时时间,之后Jenkins应该中止Pipeline。例如:
options { timeout(time: 1, unit: 'HOURS') }
https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#code-timeout-code-enforce-time-limit