具有新分支功能的SonarQube失败,返回“0”;对于一个特定的组件,一个度量值只能设置一次;?

具有新分支功能的SonarQube失败,返回“0”;对于一个特定的组件,一个度量值只能设置一次;?,sonarqube,sonarqube-scan,Sonarqube,Sonarqube Scan,在SonarQube中试用较新的分支支持功能 我遇到了一点我不明白的问题 我将SonarQube实例升级到开发者版。在长寿分支模式的分支配置下,我将其设置为(development | master),因为我们使用的是GitFlow分支策略 从Jenkins的一份工作中,我在升级到developer edition之后执行了以下操作,在该版本中,我传入了项目密钥和名称。这工作很好,我得到了一个网站项目分析显示 C:\Jenkins\sitecore\develop>SonarScanner

在SonarQube中试用较新的分支支持功能

我遇到了一点我不明白的问题

我将SonarQube实例升级到开发者版。在长寿分支模式的分支配置下,我将其设置为(development | master),因为我们使用的是GitFlow分支策略

从Jenkins的一份工作中,我在升级到developer edition之后执行了以下操作,在该版本中,我传入了项目密钥和名称。这工作很好,我得到了一个网站项目分析显示

C:\Jenkins\sitecore\develop>SonarScanner.MSBuild.exe" begin /d:sonar.login=******** /k:NEON /n:Website /v:Build#3-SHA#a37bc8060e8d5a4264140784b1f93c9a4ca80b43 /d:sonar.host.url=http://codeanalysis.remoteiv.dk /d:sonar.cs.nunit.reportsPaths=C:\Jenkins\sitecore\develop\NUnitResult.xml /d:sonar.cs.opencover.reportsPaths=C:\Jenkins\sitecore\develop\OpenCoverResult.xml
然后,对于后续运行,Jenkins使用sonar.branch.name属性传递特征分支名称,如下所示

C:\Jenkins\sitecore\feature-NEON-10-Setting-Up-Toll-Gate@2>SonarScanner.MSBuild.exe" begin /d:sonar.login=********** /k:NEON /n:Website /v:Build#5-SHA#2acea67103ab4b1223d80bf62d23999dd5369c29 /d:sonar.branch.name=feature-NEON-10-Setting-Up-Toll-Gate /d:sonar.host.url=http://codeanalysis.remoteiv.dk /d:sonar.cs.nunit.reportsPaths=C:\Jenkins\sitecore\feature-NEON-10-Setting-Up-Toll-Gate@2\NUnitResult.xml /d:sonar.cs.opencover.reportsPaths=C:\Jenkins\sitecore\feature-NEON-10-Setting-Up-Toll-Gate@2\OpenCoverResult.xml
詹金斯的最后一步说它成功了

INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=30ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=341ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=1ms
INFO: Skipping CPD calculation for short living branch
INFO: Analysis report generated in 378ms, dir size=841 KB
INFO: Analysis reports compressed in 61ms, zip size=55 KB
INFO: Analysis report uploaded in 49ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://codeanalysis.remoteiv.dk/dashboard/index/NEON
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://codeanalysis.remoteiv.dk/api/ce/task?id=AWL3Sf5q5_IkahY6f6q6
INFO: Task total time: 1:02.311 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:04.661s
INFO: Final Memory: 23M/692M
但是分析说它在服务器上失败了,在sonar服务器上的Branchs视图下没有分支

错误是

{"task":{"id":"AWL3Sf5q5_IkahY6f6q6","type":"REPORT","componentId":"AWL3Mrk25_IkahY6f6qw","componentKey":"NEON","componentName":"Website","componentQualifier":"TRK","status":"FAILED","submittedAt":"2018-04-24T12:54:04+0200","submitterLogin":"jenkins","startedAt":"2018-04-24T12:54:05+0200","executedAt":"2018-04-24T12:54:15+0200","executionTimeMs":10155,"logs":false,"errorMessage":"a measure can be set only once for a specific Component (key=NEON:BRANCH:feature-NEON-10-Setting-Up-Toll-Gate), Metric (key=test_execution_time). Use update method (Visit failed for Component {key=NEON:BRANCH:feature-NEON-10-Setting-Up-Toll-Gate,type=PROJECT} )","hasScannerContext":true,"organization":"default-organization","branch":"feature-NEON-10-Setting-Up-Toll-Gate","branchType":"SHORT"}}

任何帮助都将不胜感激。

您面临的以下错误将在SonarQube的下一版本中修复:

我发现的临时解决方法如下:

  • 转到项目“管理>常规设置”页面
  • 搜索设置
    sonar.cs.vstest.reportspath
  • 指定一个哑值,如
    foo

  • 这样,分析器就不会试图持久化单元测试信息,这样就不会失败。缺点是您将没有单元测试度量,与根本没有分析相比,这是IMO完全可以接受的。

    谢谢您提供的信息!我正在用试用许可证测试新的分支机构。所以我想我会回到CE版本和sonar.branch的老方法。SonarQube静态分析是Jenkins经营的CI/CD收费站的一部分。我们正在使用它将功能分支合并到外部集成分支中,UT覆盖率是我们允许功能分支进入集成分支的一个重要措施。我认为这肯定是短期分支的一个问题,我们正在使用SonarCloud和VST,这在我们的拉请求扫描中发生,但是我可以通过相同的CI构建运行长寿命的分支/主分支,它将非常好地工作@fabrice SonaSource团队您的团队是否有一个大致的修复时间表?我们的团队正在进行,希望我们能尽快部署修复。