首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >詹金斯退房时间是在10分钟后

詹金斯退房时间是在10分钟后
EN

Stack Overflow用户
提问于 2022-05-09 09:19:17
回答 1查看 723关注 0票数 1

我有一个管道,我做了一个检查步骤与git插件。

由于超时问题,结帐步骤在10分钟后失败。

经过我的研究,我发现git插件的默认超时值是10分钟(这正是我的问题)。

经过进一步的研究,我发现您可以通过扩展修改这个时间,如下所示:

代码语言:javascript
运行
复制
 Map checkout_settings = [
        changelog: true,
        scm: [
            $class: 'GitSCM',
            userRemoteConfigs: [
                [
                    credentialsId: ((Map) settings.credentials)?.id?.toString()?.trim() 
                    url: sttings.scmUrl.toString().trim()
                ]
            ],
            branches: [branch],
            extensions: [
                [
                    $class: 'CheckoutOption',
                    timeout: 70
                ],
                [
                    $class: 'CloneOption',
                    timeout: 70,
                    shallow: true,
                    depth: 1,
                    noTags: true
                ],
                [
                    $class: 'RelativeTargetDirectory',
                    relativeTargetDir: settings.executeFrom?.toString()?.trim() ?: ''
                ],
                [
                    $class: 'SubmoduleOption',
                    disableSubmodules: ((Map) settings.submodules)?.checkout != 'all' ?: false,
                    parentCredentials: true,
                    recursiveSubmodules: ((Map) settings.submodules)?.recursive ?: false,
                    timeout: 70
                ],
                [
                    $class: 'ScmName',
                    name: settings.scmName?.toString()?.trim() ?: settings.scmUrl.toString().trim()
                ]
            ]
        ]
    ]

我将克隆和签出选项设置为超时70分钟,并将这些设置发送到签出步骤。

代码语言:javascript
运行
复制
checkout(checkout_settings)

我本来希望能解决我的问题,但我的问题仍然存在,从日志中可以看出:

代码语言:javascript
运行
复制
The recommended git tool is: NONE
using credential sshkey
Cloning the remote Git repository
Using no checkout clone with sparse checkout.
Cloning repository ssh://git@bitbucket.trt.io/lww/ekkjp-sp2013-responsive.git
 > git init F:\ws\EJP\EJP-Core\Core\EJP_Core\1631 # timeout=10
Fetching upstream changes from ssh://git@bitbucket.trt.io/lww/ekkjp-sp2013-responsive.git
 > git --version # timeout=10
 > git --version # 'git version 2.30.0.windows.2'
using GIT_SSH to set credentials 
 > git fetch --tags --force --progress -- ssh://git@bitbucket.trt.io/lww/ekkjp-sp2013-responsive.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- ssh://git@bitbucket.trt.io/lww/ekkjp-sp2013-responsive.git +refs/heads/*:refs/remotes/origin/*" returned status code 130:

开始,然后持续一段时间,前哨会显示出来,直到事情发生为止:

代码语言:javascript
运行
复制
Receiving objects:  84% (258842/307384), 896.07 MiB | 11.99 MiB/s
Receiving objects:  84% (258842/307384), 909.63 MiB | 12.53 MiB/s
Receiving objects:  84% (259843/307384), 927.31 MiB | 12.55 MiB/s
The process tried to write to a nonexistent pipe.

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2639)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2079)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:601)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:830)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:161)
    at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:154)
    at hudson.remoting.UserRequest.perform(UserRequest.java:211)
    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
    at hudson.remoting.Request$2.run(Request.java:376)
    at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:119)
    at java.lang.Thread.run(Thread.java:829)
    Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.234.12.21/10.234.12.21:49686
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1800)
        at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
        at hudson.remoting.Channel.call(Channel.java:1001)
        at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
        at sun.reflect.GeneratedMethodAccessor823.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
        at com.sun.proxy.$Proxy167.execute(Unknown Source)
        at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1223)
        at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1301)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
        at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
        at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        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:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)

时间还在10分钟。我遗漏了什么?

EN

回答 1

Stack Overflow用户

发布于 2022-05-10 05:17:42

这意味着它不是在Jenkins级别,必须设置超时。

Jenkins主控制器需要通过SSH访问远程Git存储库宿主服务器(在您的示例中是bitbucket.trt.io)。因此,请检查SSH设置,如在此描述

检查膝上型计算机中的文件/etc/ssh/ssh_config文件(系统范围内的ssh配置)和~/.ssh/config (用户的ssh配置),并查看是否为ServerAliveIntervalServerAliveCountMax设置了任何值(用于Host *Host bitbucket.trt.io)。 如果您在这两个文件中的任何一个中没有看到这些选项,您可以做的是在任何一个文件中添加以下内容来延长连接的打开时间: 主机bitbucket.trt.io ServerAliveInterval 300 ServerAliveCountMax 2 上面的值只是一个例子,您可以根据钩子需要完成的时间来调整它们。 这些设置将使您的SSH客户端每300秒(5分钟)向Bitbucket发送一个空数据包,如果它在2次尝试后没有收到响应,则放弃。这将给您10分钟前连接超时,如果钩子需要更长的时间来完成,您可以设置一个较高的值,或两个选项。

对你来说,~/.ssh/config的意思是/home/<the-account-used-by-Jenkins>/.ssh/config

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72169628

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档