【问题标题】:How to mention token based sonar server URL in hygieia-codequality-sonar-collector application..properties如何在 hygieia-codequality-sonar-collector application..properties 中提及基于令牌的声纳服务器 URL
【发布时间】:2022-08-19 12:51:43
【问题描述】:

我创建了 Hygieia 仪表板并尝试配置声纳项目。我遵循以下 hygieia-codequality-sonar-collector 文档并运行声纳收集器。

https://github.com/Hygieia/Hygieia/blob/gh-pages/pages/hygieia/collectors/build/sonar.md

我在 application.properies 中给出了 sonar.tokens[0]= 详细信息,而不是 sonar.usernames 和 sonar.passwords。但是,得到以下登录错误。

ERROR c.c.d.collector.DefaultSonar6Client - org.springframework.web.client.HttpClientErrorException: 401
2022-08-16 04:19:00,304 [taskScheduler-1] ERROR c.c.d.collector.SonarCollectorTask - org.springframework.web.client.HttpClientErrorException: 401
2022-08-16 04:19:00,304 [taskScheduler-1] INFO  c.c.d.collect
# Database Name
        dbname=dashboarddb

        # Database HostName - default is localhost
        dbhost=localhost

        # Database Port - default is 27017
        dbport=27017

        # MongoDB replicaset
        dbreplicaset=[false if you are not using MongoDB replicaset]
        dbhostport=[host1:port1,host2:port2,host3:port3]

        # Database Username - default is blank
        dbusername=dashboarduser

        # Database Password - default is blank
        dbpassword=dbpassword

        # Collector schedule (required)
        sonar.cron=0 0/5 * * * *

        # Sonar server(s) (required) - Can provide multiple
        sonar.servers[0]=https://abc.company.com
        
        # Sonar version, match array index to the server. If not set, will default to version prior to 6.3.
        sonar.versions[0]=8.6
        
        # Sonar Metrics - Required. 
        #Sonar versions lesser than 6.3
        
        # Sonar tokens to connect to authenticated url 
        sonar.tokens[0]=xxxxxxxxx
        #sonar.metrics[0]=ncloc,line_coverage,violations,critical_violations,major_violations,blocker_violations,violations_density,sqale_index,test_success_density,test_failures,test_errors,tests
        
        # For Sonar version 6.3 and above
        sonar.metrics[0]=ncloc,violations,new_vulnerabilities,critical_violations,major_violations,blocker_violations,tests,test_success_density,test_errors,test_failures,coverage,line_coverage,sqale_index,alert_status,quality_gate_details
        
        # Sonar login credentials
        # Format: username1,username2,username3,etc.
        #sonar.usernames= 
        # Format: password1,password2,password3,etc.
        #sonar.passwords=

请帮助我。

    标签: sonarqube collectors hygieia


    【解决方案1】:

    更新sonar.servers[0] URL 后,我修复了基于令牌的声纳登录问题

    正确的 application.properties 文件:

    # Database Name
            dbname=dashboarddb
    
            # Database HostName - default is localhost
            dbhost=localhost
    
            # Database Port - default is 27017
            dbport=27017
    
            # MongoDB replicaset
            dbreplicaset=[false if you are not using MongoDB replicaset]
            dbhostport=[host1:port1,host2:port2,host3:port3]
    
            # Database Username - default is blank
            dbusername=dashboarduser
    
            # Database Password - default is blank
            dbpassword=dbpassword
    
            # Collector schedule (required)
            sonar.cron=0 0/5 * * * *
    
            # Sonar server(s) (required) - Can provide multiple
             sonar.servers[0]=https://api-token@abc.company.com
            
            # Sonar version, match array index to the server. If not set, will default to version prior to 6.3.
            sonar.versions[0]=8.6
            
            # Sonar Metrics - Required. 
            #Sonar versions lesser than 6.3
            
            # Sonar tokens to connect to authenticated url 
            sonar.tokens[0]=xxxxxxxxx
            #sonar.metrics[0]=ncloc,line_coverage,violations,critical_violations,major_violations,blocker_violations,violations_density,sqale_index,test_success_density,test_failures,test_errors,tests
            
            # For Sonar version 6.3 and above
            sonar.metrics[0]=ncloc,violations,new_vulnerabilities,critical_violations,major_violations,blocker_violations,tests,test_success_density,test_errors,test_failures,coverage,line_coverage,sqale_index,alert_status,quality_gate_details
            
            # Sonar login credentials
            # Format: username1,username2,username3,etc.
            #sonar.usernames= 
            # Format: password1,password2,password3,etc.
            #sonar.passwords=
    

    谢谢你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-03
      • 2020-05-18
      • 1970-01-01
      • 2012-03-21
      • 2021-01-07
      • 1970-01-01
      • 2021-10-03
      • 2018-03-30
      相关资源
      最近更新 更多