gpt4 book ai didi

docker - Jenkins 管道 docker.image 调用产生超时

转载 作者:行者123 更新时间:2023-12-04 12:37:03 25 4
gpt4 key购买 nike

我最近升级了我的 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)

最佳答案

问题是由于硬编码的 10 秒超时值造成的,可以从这个链接中读取; docker workflow plugin https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L268

在某些情况下,这太短了。一种解决方案是将此超时值作为由用户设置的参数。

关于docker - Jenkins 管道 docker.image 调用产生超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42808840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com