gitlab ci时报auto_devops命令异常

  • Choerodon平台版本: 0.23.6

  • 遇到问题的执行步骤:

  • 文档地址:

  • 环境信息(如:节点信息):

  • 报错日志:
    Updating/initializing submodules recursively…
    Submodule ‘uipublic’ (http://gitlab-ci-token:[MASKED]@gitlab-c7n.cfms.com/operation-hhbl-project/npm-uipublic.git) registered for path ‘uipublic’
    Cloning into ‘/builds/operation-hhbl-project/ccu-web/uipublic’…
    Submodule path ‘uipublic’: checked out ‘aa51c8ba2c09a4d43ff2e8d25a49a9fdafd3de61’
    Entering ‘uipublic’
    $ http_status_code=curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=front" # collapsed multi-line command
    .auto_devops.sh: line 1: failed:true: command not found
    ERROR: Job failed: command terminated with exit code 1

  • 原因分析:

    以下是gitlab-ci.yml文件的配置

.auto_devops: &auto_devops |
http_status_code=curl -o .auto_devops.sh -s -m 10 --connect-timeout 10 -w %{http_code} "${CHOERODON_URL}/devops/ci?token=${Token}&type=front"
if [ “$http_status_code” != “200” ]; then
cat .auto_devops.sh
exit 1
fi
source .auto_devops.sh

function node_module(){
npm run i
}

function node_build(){
npm run ${1:-“uat”}
}

before_script:

  • *auto_devops

你请求这个接口看拿到的脚本是什么


这里的choerodon_url和token的参数值,如何获取到?
直接尝试了curl,返回的是000

choerodon_url 是网关地址,
token可以在gitlab,Settings >> CI / CD >> Variables可以看到


报的404

网关地址我直接打开是提示没有权限的

这个token明显格式不对,你复制完整了吗?

:rofl:


用了正确的token就是返回的200

然后,你看看你下载得到的 .auto_devops.sh 文件内容是什么?
如果是形如:

{"failed": true ...}

就不正常,这种情况你截图下内容发出来。

{“failed”:true,“code”:“error.network”,“message”:“网络异常,请稍后重试”,“type”:“warn”,“exception”:“BaseServiceClient#queryIamProject(Long,Boolean,Boolean,Boolean) failed and fallback failed.”,“throwable”:[“com.netflix.client.ClientException: Load balancer does not have available server for client: choerodon-iam”,“org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:71)”,“feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:98)”,“feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77)”,“feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:107)”,“com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)”,“com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)”,“rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)”,“rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)”,“rx.Observable.unsafeSubscribe(Observable.java:10327)”,“rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51)”,“rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35)”,“rx.Observable.unsafeSubscribe(Observable.java:10327)”,“rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41)”,“rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)”,“rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)”,“rx.Observable.unsafeSubscribe(Observable.java:10327)”,“rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)”,“com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)”,“com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)”,“org.springframework.security.concurrent.DelegatingSecurityContextCallable.call(DelegatingSecurityContextCallable.java:87)”,“org.hzero.core.hystrix.AbstractCallable.call(AbstractCallable.java:15)”,“org.hzero.core.hystrix.RequestAttributeCallableWrapper$RequestAttributeCallable.call(RequestAttributeCallableWrapper.java:35)”,“com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)”,“rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)”,“java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)”,“java.util.concurrent.FutureTask.run(Unknown Source)”,“java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)”,“java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)”,“java.lang.Thread.run(Unknown Source)”]}

iam服务有问题,但是我在后台看


iam是正常的

你现在猪齿鱼界面功能是正常的吗?

界面功能不正常,打不开。

注册中心界面截图,看下iam注册到注册中心了么

注册中心的界面在浏览器上打不开,估计是容器端口未对外暴露 :broken_heart:,进到注册中心的容器中去看,也没有查到任何内容,是操作不对?

建议将端口暴露出来,找不到choerodon-iam有两种情况,一是服务没注册上去,二是路由不对;
没有其他信息这边判断不了;还有就是应该curl http://localhost:8000/

在注册中心容器后台看了下,在注册中心的服务有
AGILE-SERVICE,
CHOERODON-ASGARD,
CHOERODON-GATEWAY,
CHOERODON-OAUTH,
CHOERODON-SWAGGER,
DEVOPS-SERVICE,
GITLAB-SERVICE,
KNOWLEDGEBASE-SERVICE,
PROD-REPO-SERVICE,
TEST-MANAGER-SERVICE,
WORKFLOW-SERVICE
没有 iam服务注册

看下iam的日志,是否正常运行


能否远程帮忙看一下?

iam对应的redis db,查看下keys *snow* 如果有lock相关的key 删掉