sonar使用猪齿鱼登陆失败



数据的SECRET是secret,你的client_secret应该也是secret

如果能正确获取到token,待会重定向地址改为最开始的http://sonar.dongfang.cn/oauth2/callback/choerodon ;然后将sonar配置的secret,改为你数据库的secret
image

在sonar中把choerodon插件中的 secret修改为secret就可以了
官方的安装文档里只有修改enable和choeron url的api地址,sonar的secret我都没改过呀,怎么会有这个问题?

好的。待会更新下文档

但是现在点击开发流水线中的代码质量页面提示:
sonarqube用户名或密码错误

devons-service的日志出错信息如下:

2019-07-18 16:32:38.650  INFO 7 --- [nio-8060-exec-2] i.c.r.h.ControllerExceptionHandler       : exception info io.choerodon.core.exception.CommonException: error.sonarqube.user
	at io.choerodon.devops.app.service.impl.ApplicationServiceImpl.getSonarContent(ApplicationServiceImpl.java:1282)
	at io.choerodon.devops.app.service.impl.ApplicationServiceImpl$$FastClassBySpringCGLIB$$3cc5d987.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
	at io.choerodon.devops.app.service.impl.ApplicationServiceImpl$$EnhancerBySpringCGLIB$$1813c3a8.getSonarContent(<generated>)
	at io.choerodon.devops.api.controller.v1.ApplicationController.getSonarQube(ApplicationController.java:516)
	at sun.reflect.GeneratedMethodAccessor2557.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at io.choerodon.resource.filter.JwtTokenFilter.doFilter(JwtTokenFilter.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:209)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:155)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:123)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:813)

这个要去那里修改?
我昨天把猪齿鱼从0.16升级到0.17的,按照升级文档操作的。

我的devops-service的deployment内容如下:

kubectl get deployments -n c7n-system devops-service -o yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "3"
  creationTimestamp: "2019-05-18T04:51:24Z"
  generation: 3
  labels:
    choerodon.io/logs-parser: spring-boot
    choerodon.io/release: devops-service
  name: devops-service
  namespace: c7n-system
  resourceVersion: "14379231"
  selfLink: /apis/extensions/v1beta1/namespaces/c7n-system/deployments/devops-service
  uid: 96b6ff0b-7928-11e9-8298-20040ff6e100
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      choerodon.io/release: devops-service
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        choerodon.io/metrics-group: spring-boot
        choerodon.io/metrics-path: /actuator/prometheus
      creationTimestamp: null
      labels:
        choerodon.io/metrics-port: "8061"
        choerodon.io/release: devops-service
        choerodon.io/service: devops-service
        choerodon.io/version: 0.17.2
    spec:
      containers:
      - env:
        - name: AGENT_CERTMANAGERURL
          value: https://openchart.choerodon.com.cn/choerodon/infra/
        - name: AGENT_REPOURL
          value: https://openchart.choerodon.com.cn/choerodon/c7n/
        - name: AGENT_SERVICEURL
          value: ws://devops.dongfang.cn/agent/
        - name: AGENT_VERSION
          value: 0.17.0
        - name: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE
          value: http://register-server.c7n-system:8000/eureka/
        - name: PRO_API_HOST
          value: gateway.choerodon.com.cn
        - name: PRO_CLIENT_ID
          value: devops
        - name: PRO_COOKIE_SERVER
          value: choerodon.com.cn
        - name: PRO_DEVOPS_HOST
          value: localhost:8060
        - name: PRO_FILE_SERVER
          value: http://minio.choerodon.com.cn
        - name: PRO_HEADER_TITLE_NAME
          value: Choerodon
        - name: PRO_HTTP
          value: http
        - name: PRO_LOCAL
          value: "true"
        - name: PRO_TITLE_NAME
          value: Choerodon
        - name: SECURITY_IGNORED
          value: /ci,/webhook,/v2/api-docs,/agent/**,/ws/**,/webhook/**
        - name: SERVICES_GATEWAY_URL
          value: http://api.dongfang.cn
        - name: SERVICES_GITLAB_PASSWORD
          value: password
        - name: SERVICES_GITLAB_PROJECTLIMIT
          value: "100"
        - name: SERVICES_GITLAB_SSHURL
          value: gitlab.dongfang.cn:2289
        - name: SERVICES_GITLAB_URL
          value: http://gitlab.dongfang.cn
        - name: SERVICES_HARBOR_BASEURL
          value: https://registry.dongfang.cn
        - name: SERVICES_HARBOR_INSECURESKIPTLSVERIFY
          value: "true"
        - name: SERVICES_HARBOR_PASSWORD
          value: Harbor12345
        - name: SERVICES_HARBOR_USERNAME
          value: admin
        - name: SERVICES_HELM_URL
          value: http://chart.dongfang.cn
        - name: SERVICES_SONARQUBE_PASSWORD
          value: admin
        - name: SERVICES_SONARQUBE_URL
          value: http://sonar.dongfang.cn
        - name: SERVICES_SONARQUBE_USERNAME
          value: admin
        - name: SPRING_CLOUD_CONFIG_ENABLED
          value: "true"
        - name: SPRING_CLOUD_CONFIG_URI
          value: http://register-server.c7n-system:8000/
        - name: SPRING_DATASOURCE_PASSWORD
          value: password
        - name: SPRING_DATASOURCE_URL
          value: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/devops_service?useUnicode=true&characterEncoding=utf-8&useSSL=false
        - name: SPRING_DATASOURCE_USERNAME
          value: choerodon
        - name: SPRING_REDIS_DATABASE
          value: "11"
        - name: SPRING_REDIS_HOST
          value: c7n-redis.c7n-system.svc
        - name: TEMPLATE_URL
          value: https://github.com/choerodon/choerodon-devops-templates.git
        - name: TEMPLATE_VERSION
          value: 0.17.0
        image: registry.cn-shanghai.aliyuncs.com/choerodon/devops-service:0.17.2
        imagePullPolicy: IfNotPresent
        name: devops-service
        ports:
        - containerPort: 8060
          name: http
          protocol: TCP
        readinessProbe:
          exec:
            command:
            - /bin/sh
            - -c
            - curl -s localhost:8061/actuator/health --fail && nc -z localhost 8060
          failureThreshold: 3
          initialDelaySeconds: 60
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 60
        resources:
          limits:
            memory: 4Gi
          requests:
            memory: 2Gi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2019-07-16T18:58:10Z"
    lastUpdateTime: "2019-07-16T18:58:10Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2019-05-18T04:51:24Z"
    lastUpdateTime: "2019-07-17T02:05:23Z"
    message: ReplicaSet "devops-service-77b6bbc54d" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 3
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1


sonar里用户名密码都是admin,这个是没错的

现在sonar只能使用猪齿鱼登陆,选择用户名密码登陆的时候输入admin/admin是提示验证失败。


这边做请求管理是需要对应的client的,直接在平台是可以查看客户端的相关信息的

文档中这一步就是添加client的,现在文档中有个参数应该是错误的,修改了就好

用其他方式登录就是你安装sonar时候的参数了,这里就是加了个外部的oauth而已,不会关闭原有的认证体系的

http://sonar.dongfang.cn/api/authentication/login

这个地址是原来sonar的登陆api接口么?

我在sonar使用用户名密码登陆的时候web页面的console提示这个页面401

这个是sonar自己的,外部认证的path都是oauth的

iam_service.oauth_client的数据我也没问题呀,猪齿鱼界面的客户端也都有,但是就是开发流水线的代码质量页面提示sonar密码错误

还有sonar使用admin/admin登陆失败,sonar登陆失败也没什么日志。

可能是sonar的一个bug,可以重置下admin密码。choerodon-sonar插件是没有动过sonar管理员的用户和密码的
https://blog.csdn.net/digvwell/article/details/69944958

你们选择的sonar数据库是sonarqube-postgresql啊:sweat_smile:

可以根据自己数据库更改下,这个SonarQube7.6官方文档
https://docs.sonarqube.org/7.6/instance-administration/security/

我也遇到了类似的问题。 sonar在使用猪齿鱼登录时显示


sonarqube 服务日志显示

按照上面 您给的方式进行 手动使用授权码模式认证。
在第3 步 postman提示

这是什么原因导致的呢

@Lano @ChangpingShi 大佬,这是什么原因导致的呀

你好,请问在devops-service配置SonarQube的环境变量了么
image

没有,是使用以下命令吗?
helm upgrade devops-service c7n/devops-service
-f <(helm get values devops-service)
–set env.open.SERVICES_SONARQUBE_USERNAME=admin
–set env.open.SERVICES_SONARQUBE_URL=http://sonar.op.sisyphe.win
–set env.open.SERVICES_SONARQUBE_PASSWORD=admin
–version 0.18.2