chart_build 阶段出现上传超时错误

  • Choerodon平台版本:0.19.0

  • 运行环境:自主搭建

  • 问题描述:

在 GItLab 处执行流水线,在 chart_build 阶段上传 chart 的时候出现超时错误,GitLab 流水线日志如下:

Successfully packaged chart and saved it to: /operation-srm-test/srm-front-core/srm-front-core-2020.2.14-174354-develop.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2721    0     0  100  2721      0   2258  0:00:01  0:00:01 --:--:--  2258
100  2721    0     0  100  2721      0   1233  0:00:02  0:00:02 --:--:--  1233
100  2721    0     0  100  2721      0    848  0:00:03  0:00:03 --:--:--   848
100  2721    0     0  100  2721      0    646  0:00:04  0:00:04 --:--:--   646
100  2721    0     0  100  2721      0    522  0:00:05  0:00:05 --:--:--   522
100  2721    0     0  100  2721      0    438  0:00:06  0:00:06 --:--:--     0
100  2721    0     0  100  2721      0    438  0:00:06  0:00:06 --:--:--     0
100  2721    0     0  100  2721      0    377  0:00:07  0:00:07 --:--:--     0
100  2721    0     0  100  2721      0    331  0:00:08  0:00:08 --:--:--     0
100  2721    0     0  100  2721      0    295  0:00:09  0:00:09 --:--:--     0
100 11902    0  9181  100  2721    904    267  0:00:10  0:00:10 --:--:--  2327
{"failed":true,"code":null,"message":"io.choerodon.devops.infra.exception.DevopsCiInvalidException
 io.choerodon.devops.app.service.impl.AppServiceVersionServiceImpl.create(AppServiceVersionServiceImpl.java:101)
 io.choerodon.devops.api.controller.v1.CiController.create(CiController.java:77)
 sun.reflect.GeneratedMethodAccessor2343.invoke(Unknown Source)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 java.lang.reflect.Method.invoke(Method.java:498)
 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
 org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
 org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
 org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
 org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
 org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
 org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
 org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
 org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:209)
 org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
 org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
 org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:155)
 org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:123)
 org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108)
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
 org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 java.lang.Thread.run(Thread.java:813)\nCaused by: java.net.SocketTimeoutException: connect timed out
 java.net.Socket.connect(Socket.java:589)
 okhttp3.internal.platform.Platform.connectSocket(Platform.java:124)
 okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:223)
 okhttp3.internal.connection.RealConnection.connect(RealConnection.java:149)
 okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:195)
 okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
 okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
 okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
 okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
 okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
 okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
 okhttp3.RealCall.execute(RealCall.java:69)
 retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
 io.choerodon.devops.infra.util.ChartUtil.uploadChart(ChartUtil.java:57)
 io.choerodon.devops.app.service.impl.AppServiceVersionServiceImpl.doCreate(AppServiceVersionServiceImpl.java:129)
 io.choerodon.devops.app.service.impl.AppServiceVersionServiceImpl.create(AppServiceVersionServiceImpl.java:98)\n\t... 70 more\n"}
upload to devops error
ERROR: Job failed: error executing remote command: command terminated with non-zero exit code: Error executing in Docker Container: 1

你好,请确认下你部署devops-service时配置的chartMuseum的地址是否能够正常访问?

你好,刚刚检查过 Chart Museum 是可以访问的,但是在访问 /api/charts 的时候没有返回应用部署服务相关的chart信息,请问猪齿鱼一共有几个 chart museum?DevOps 的时候使用的是哪一个?

只有一个chartMuseum,正常情况下,只要配置devops-service的参数里的地址对了,就可以了。

请问是 AGENT_REPOURL 环境变量么?

你好,是这个

这个环境变量看起来设置的也是没问题的:

AGENT_REPOURL: http://chart..t-brdevops.myoas.local/c7n/c7n/
SERVICES_HELM_URL: http://chart.t-brdevops.myoas.local

而且 SERVICES_HELM_URL 在 gitlab runner 的容器中也是可以ping通的。

AGENT_REPOURL用的是猪齿鱼官方仓库的,用于获取choerodon-cluster-agent的chart的,激活集群时有用;
SERVICES_HELM_URL这个地址是你自己的chartMuseum地址,要在devops-service的容器里ping通

我纠正了一下设置,其实agent_repourl的地址设置有问题,多了一个点:

这个会导致上传失败么?

AGENT_REPOURL用的是猪齿鱼官方仓库的,这个值是固定的,不用改的。按照官方文档的,用于获取choerodon-cluster-agent的chart的,激活集群时有用;
image
SERVICES_HELM_URL这个地址是你自己的chartMuseum地址,要在 devops-service 的容器里ping通

了解。现在客户那边重启了devops-sevice服务,然后重新执行了一下 GitLab 的流水线,发现正常了。总感觉“重启了服务”这个动作是恢复正常了的主因。。。

好的,下次有这种情况,你在devops-service的容器里执行下这个命令curl http://chart.t-brdevops.myoas.local/operation/srm-test/api/charts看看响应。url里的/operation/srm-test分别是你的组织code和项目Code。

1赞

您好,我现在流水线 chart_build Successfully ,但是在chartmuseum的持久化目录中并没有char包,在 devops-service 的容器里执行下这个命令 curl http://chartmuseum.centrin.localdomain/operation/zjcloud/api/charts 报default backend - 404,请问怎么解决

把你的ci日志发出来看一下

谢谢,已经解决了,是因为我新环境和老环境的chartmuseum的域名不一致