Sonarqube - SCM提供程序自动检测和PR修饰无法在.git目录中进行分析

q0qdq0h2  于 2022-11-20  发布在  Git
关注(0)|答案(1)|浏览(81)

必须分享的信息:

  • 声纳Qube 9.1
  • 团队城市
  • 团队工具:用于MSBuild 4.8.12008的声纳扫描仪
  • 在Dockerfile中运行声纳分析命令
  • 目标:使SCM自动检测和PR装饰工作,以便Sonar可以将质量门报告和装饰发布到Github Repo

我花了一整天的时间试图让这个工作没有运气。尝试了许多事情已经建议在许多线程,但不能解决这个问题。希望有人在这里可以看看,并保存我:)
在对项目进行Sonar Analysis扫描时,我在SonarQube中收到两个警告:

  • SCM提供程序自动检测失败.请使用“sonar.scm.provider”定义项目得SCM,或在项目设置中禁用SCM传感器.
  • 装饰失败,无修订信息

这些是声纳日志用于分析:

Step 34/41 : RUN if [ -n "$SONAR_LOGIN" ]; then dotnet-sonarscanner end /d:sonar.login=$SONAR_LOGIN; fi
      Docker event: {"status":"destroy","id":"fc409ea02296ddf0ee9fc6471dab927268f1ec9eea3b1771c825ce575d332a23","from":"sha256:39c23cd9879fb2871c00d0bf3873478919f5d57064cfee598729578528386a93","Type":"container","Action":"destroy","Actor":{"ID":"fc409ea02296ddf0ee9fc6471dab927268f1ec9eea3b1771c825ce575d332a23","Attributes":{"image":"sha256:39c23cd9879fb2871c00d0bf3873478919f5d57064cfee598729578528386a93","name":"eager_jackson"}},"scope":"local","time":1636400846,"timeNano":1636400846688421496}
       ---> Running in 409fa2e67ae7
      Docker event: {"status":"create","id":"409fa2e67ae70fedbbdb8ceac00acda59e06a646456f035d12c60d981a301987","from":"sha256:51fdd0e76ab4832a12298b0e5f830b0e659a5d554bb8d26fae75690d44d8c4b4","Type":"container","Action":"create","Actor":{"ID":"409fa2e67ae70fedbbdb8ceac00acda59e06a646456f035d12c60d981a301987","Attributes":{"image":"sha256:51fdd0e76ab4832a12298b0e5f830b0e659a5d554bb8d26fae75690d44d8c4b4","name":"happy_cori"}},"scope":"local","time":1636400846,"timeNano":1636400846769300895}
      Docker event: {"status":"attach","id":"409fa2e67ae70fedbbdb8ceac00acda59e06a646456f035d12c60d981a301987","from":"sha256:51fdd0e76ab4832a12298b0e5f830b0e659a5d554bb8d26fae75690d44d8c4b4","Type":"container","Action":"attach","Actor":{"ID":"409fa2e67ae70fedbbdb8ceac00acda59e06a646456f035d12c60d981a301987","Attributes":{"image":"sha256:51fdd0e76ab4832a12298b0e5f830b0e659a5d554bb8d26fae75690d44d8c4b4","name":"happy_cori"}},"scope":"local","time":1636400846,"timeNano":1636400846769512782}
      Docker event: {"status":"start","id":"409fa2e67ae70fedbbdb8ceac00acda59e06a646456f035d12c60d981a301987","from":"sha256:51fdd0e76ab4832a12298b0e5f830b0e659a5d554bb8d26fae75690d44d8c4b4","Type":"container","Action":"start","Actor":{"ID":"409fa2e67ae70fedbbdb8ceac00acda59e06a646456f035d12c60d981a301987","Attributes":{"image":"sha256:51fdd0e76ab4832a12298b0e5f830b0e659a5d554bb8d26fae75690d44d8c4b4","name":"happy_cori"}},"scope":"local","time":1636400847,"timeNano":1636400847095143532}
      SonarScanner for MSBuild 5.3.2
      Using the .NET Core version of the Scanner for MSBuild
      Post-processing started.
      Calling the SonarScanner CLI...
      Scanner configuration file: /root/.dotnet/tools/.store/dotnet-sonarscanner/5.3.2/dotnet-sonarscanner/5.3.2/tools/netcoreapp3.0/any/sonar-scanner-4.6.2.2472/conf/sonar-scanner.properties
      Project root configuration file: /source/.sonarqube/out/sonar-project.properties
      SonarScanner 4.6.2.2472
      Java 11.0.13 Oracle Corporation (64-bit)
      Linux 4.15.0-156-generic amd64
      User cache: /root/.sonar/cache
      Scanner configuration file: /root/.dotnet/tools/.store/dotnet-sonarscanner/5.3.2/dotnet-sonarscanner/5.3.2/tools/netcoreapp3.0/any/sonar-scanner-4.6.2.2472/conf/sonar-scanner.properties
      Project root configuration file: /source/.sonarqube/out/sonar-project.properties
      Analyzing on SonarQube server 9.1.0
      User cache: /root/.sonar/cache
      Load/download plugins
      Load plugins index
      Load plugins index (done) | time=48ms
      Load/download plugins (done) | time=5012ms
      Loaded core extensions: developer-scanner
      Process project properties
      Process project properties (done) | time=26ms
      Execute project builders
      Execute project builders (done) | time=45ms
      Project key: plentyofcode_Matching
      Base dir: /source
      Working dir: /source/.sonarqube/out/.sonar
      Load project settings for component key: 'plentyofcode_Matching' (done) | time=59ms
      Load project branches (done) | time=48ms
      Load project pull requests (done) | time=62ms
      Load branch configuration
      Found manual configuration of branch/PR analysis. Skipping automatic configuration.
      Load branch configuration (done) | time=3ms
      Load quality profiles (done) | time=119ms
      Load active rules (done) | time=3085ms
      WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
      Pull request 3 for merge into release/2.3.0 from PR1-Test
      Indexing files...
      Project configuration:
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      Indexing files of module 'Matching.Tests'
        Base dir: /source/tests/Matching.Tests
        Test paths: Controllers/ApiControllerTests.cs, Logic/Handlers/Events/Accoun...
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      Load project repositories
      Load project repositories (done) | time=36ms
      Indexing files of module 'Matching.Benchmarks'
        Base dir: /source/tests/Matching.Benchmarks
        Source paths: Handlers/Events/AccountActivatedHandlerBenchmarks.cs, Handler...
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      Indexing files of module 'Matching'
        Base dir: /source/src/Matching
        Source paths: Controllers/ApiController.cs, Middleware/ExceptionMiddleware....
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      Indexing files of module 'Matching.Migration'
        Base dir: /source/src/Matching.Migration
        Source paths: Extensions/CustomTableJournal.cs, Extensions/DbUpExtensions.c...
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      Indexing files of module 'Matching.IntegrationTests'
        Base dir: /source/tests/Matching.IntegrationTests
        Test paths: Http/BroadcastViewerTests.cs, Http/FirstLookHandlerTests.cs, Ht...
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      Indexing files of module 'MatchingGH'
        Base dir: /source
        Excluded sources: *.generated.*, *Generat*, *generated*, AssemblyInfo.cs, **/AssemblyInfo.cs, **/AssemblyVersionInfo.cs, api.html, **/Startup.cs, **/Program.cs, **/*.sql
        Excluded tests: **/*.json
      340 files indexed
      104 files ignored because of inclusion/exclusion patterns
      Quality profile for cs: Sonar way
      ------------- Run sensors on module Matching
      Load metrics repository
      Load metrics repository (done) | time=38ms
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=1ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=5ms
      Sensor C# Properties [csharp] (done) | time=1ms
      Sensor JavaXmlSensor [java] (done) | time=0ms
      Sensor HTML [web]
      Sensor HTML [web] (done) | time=2ms
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=53ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=1ms
      ------------- Run sensors on module Matching.Benchmarks
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=0ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=2ms
      Sensor C# Properties [csharp]
      Sensor C# Properties [csharp] (done) | time=0ms
      Sensor JavaXmlSensor [java]
      Sensor JavaXmlSensor [java] (done) | time=1ms
      Sensor HTML [web]
      Sensor HTML [web] (done) | time=0ms
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=2ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=1ms
      ------------- Run sensors on module Matching.Logic
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=0ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=1ms
      Sensor VB.NET Properties [vbnet] (done) | time=0ms
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=1ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=1ms
      ------------- Run sensors on module Matching.Migration
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=1ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=0ms
      ------------- Run sensors on module Matching.IntegrationTests
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=1ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=1ms
      Sensor C# Properties [csharp]
      Sensor C# Properties [csharp] (done) | time=0ms
      Sensor JavaXmlSensor [java]
      Sensor JavaXmlSensor [java] (done) | time=1ms
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=1ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=0ms
      ------------- Run sensors on module ImageBarsSync.Cli
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=0ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp7_1
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=1ms
      Sensor C# Properties [csharp]
      Sensor C# Properties [csharp] (done) | time=1ms
      Sensor JavaXmlSensor [java]
      Sensor JavaXmlSensor [java] (done) | time=0ms
      Sensor HTML [web]
      Sensor HTML [web] (done) | time=1ms
      Sensor VB.NET Project Type Information [vbnet]
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=1ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=1ms
      ------------- Run sensors on module MeetMe.Migration
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=0ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=1ms
      Sensor C# Properties [csharp]
      Sensor C# Properties [csharp] (done) | time=1ms
      Sensor JavaXmlSensor [java]
      Sensor JavaXmlSensor [java] (done) | time=0ms
      Sensor HTML [web]
      Sensor HTML [web] (done) | time=0ms
      Sensor VB.NET Project Type Information [vbnet]
      Sensor VB.NET Project Type Information [vbnet] (done) | time=0ms
      Sensor VB.NET Analysis Log [vbnet]
      Sensor VB.NET Analysis Log [vbnet] (done) | time=1ms
      Sensor VB.NET Properties [vbnet]
      Sensor VB.NET Properties [vbnet] (done) | time=0ms
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=1ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=0ms
      ------------- Run sensors on module Matching.Tests
      Sensor C# Project Type Information [csharp]
      Sensor C# Project Type Information [csharp] (done) | time=0ms
      Sensor C# Analysis Log [csharp]
      Roslyn version: 3.7.0.0
      Language version: CSharp8
      Concurrent execution: disabled
      Sensor C# Analysis Log [csharp] (done) | time=1ms
      Sensor C# Properties [csharp]
      Sensor C# Properties [csharp] (done) | time=1ms
      Sensor JavaXmlSensor [java]
      Sensor JavaXmlSensor [java] (done) | time=1ms
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      ------------- Run sensors on module MatchingGH
      Sensor JaCoCo XML Report Importer [jacoco]
      'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
      No report imported, no coverage information will be imported by JaCoCo XML Report Importer
      Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
      Sensor ThymeLeaf template sensor [securityjavafrontend]
      Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
      Sensor Serverless configuration file sensor [securityjsfrontend]
      0 Serverless function entries were found in the project
      0 Serverless function handlers were kept as entrypoints
      Sensor Serverless configuration file sensor [securityjsfrontend] (done) | time=1ms
      Sensor AWS SAM template file sensor [securityjsfrontend]
      Sensor AWS SAM template file sensor [securityjsfrontend] (done) | time=1ms
      Sensor JavaSecuritySensor [security]
      Reading type hierarchy from: /source/.sonarqube/out/.sonar/ucfg2/java
      Read 0 type definitions
      Reading UCFGs from: /source/.sonarqube/out/.sonar/ucfg2/java
      No UCFGs have been included for analysis.
      Sensor JavaSecuritySensor [security] (done) | time=3ms
      Sensor CSharpSecuritySensor [security]
      Reading type hierarchy from: /source/.sonarqube/out/ucfg_cs2
      Read 176 type definitions
      Reading UCFGs from: /source/.sonarqube/out/ucfg_cs2
      Analyzing 1888 ucfgs to detect vulnerabilities.
      All rules entrypoints : 0
      Retained UCFGs : 0
      Taint analysis starting. Entrypoints: 0
      Taint analysis: done.
      Sensor CSharpSecuritySensor [security] (done) | time=2039ms
      Sensor PhpSecuritySensor [security]
      Reading type hierarchy from: /source/.sonarqube/out/.sonar/ucfg2/php
      Read 0 type definitions
      Reading UCFGs from: /source/.sonarqube/out/.sonar/ucfg2/php
      No UCFGs have been included for analysis.
      Sensor PhpSecuritySensor [security] (done) | time=0ms
      Sensor PythonSecuritySensor [security]
      Reading type hierarchy from: /source/.sonarqube/out/.sonar/ucfg2/python
      Read 0 type definitions
      Reading UCFGs from: /source/.sonarqube/out/.sonar/ucfg2/python
      No UCFGs have been included for analysis.
      Sensor PythonSecuritySensor [security] (done) | time=1ms
      Sensor JsSecuritySensor [security]
      Reading type hierarchy from: /source/.sonarqube/out/.sonar/ucfg2/js
      Read 0 type definitions
      Reading UCFGs from: /source/.sonarqube/out/.sonar/ucfg2/js
      19:47:42.897046 Building Runtime Type propagation graph
      19:47:42.897208 Running Tarjan on 0 nodes
      19:47:42.897318 Tarjan found 0 components
      19:47:42.897434 Variable type analysis: done
      19:47:42.897484 Building Runtime Type propagation graph
      19:47:42.897618 Running Tarjan on 0 nodes
      19:47:42.897752 Tarjan found 0 components
      19:47:42.897839 Variable type analysis: done
      Analyzing 2 ucfgs to detect vulnerabilities.
      Taint analysis starting. Entrypoints: 3
      Running symbolic analysis for 'JS'
      Taint analysis: done.
      Sensor JsSecuritySensor [security] (done) | time=205ms
      ------------- Run sensors on project
      Sensor C# [csharp]
      Importing results from 6 proto files in '/source/.sonarqube/out/5/output-cs'
      Importing results from 6 proto files in '/source/.sonarqube/out/6/output-cs'
      Importing 8 Roslyn reports
      Found 8 MSBuild C# projects: 6 MAIN projects. 2 TEST projects.
      Sensor C# [csharp] (done) | time=528ms
      Sensor C# Tests Coverage Report Import [csharp]
      Parsing the OpenCover report /artifacts/reports/coverage.opencover.xml
      Adding this code coverage report to the cache for later reuse: /artifacts/reports/coverage.opencover.xml
      Coverage Report Statistics: 118 files, 118 main files, 118 main files with coverage, 0 test files, 0 project excluded files, 0 other language files.
      Sensor C# Tests Coverage Report Import [csharp] (done) | time=134ms
      Sensor Zero Coverage Sensor
      Sensor Zero Coverage Sensor (done) | time=7ms
      SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
      CPD Executor 42 files had no CPD blocks
      CPD Executor Calculating CPD for 145 files
      CPD Executor CPD calculation finished (done) | time=46ms
      Analysis report generated in 113ms, dir size=1.9 MB
      Analysis report compressed in 339ms, zip size=809.5 kB
      Analysis report uploaded in 140ms
      ------------- Check Quality Gate status
      Waiting for the analysis report to be processed (max 300s)
      ------------------------------------------------------------------------
      EXECUTION FAILURE
      ------------------------------------------------------------------------
      Total time: 42.217s
      Final Memory: 33M/127M
      ------------------------------------------------------------------------
       [91mERROR: Error during SonarScanner execution
       [0m [91mERROR: QUALITY GATE STATUS: FAILED - View details on http://sonar.integration.pof.local:9000/dashboard?id=plentyofcode_Matching&pullRequest=3
       [0m [91mERROR: 
       [0m [91mThe SonarScanner did not complete successfully

我知道如果SCM不工作,这意味着分析看不到项目目录中的.git文件。但是有!这是TeamCity checkout 代码的目录(我正在执行代理端 checkout ),您可以在那里看到.git目录:
为了证明这一点,我按照一些线程中的建议,显式地向Sonar analysis命令添加了以下参数:/d:sonal.projectBaseDir=%teamcity.build.checkoutDir%〈-(在具有.git目录之上构建 checkout 目录)/d:sonal.scm.provider=git
运行后,它会给出以下错误:错误:SonarScanner执行期间出错****错误:不在Git工作树中:/home/tcservice/构建代理/工作/59055310711 a86 a1
但是正如你在上面看到的,这个目录在一个工作树里面!2这个分析的完整日志在这里:

Step 35/42 : RUN if [ -n "$SONAR_LOGIN" ]; then dotnet-sonarscanner end /d:sonar.login=$SONAR_LOGIN; fi
      Docker event: {"status":"destroy","id":"869a9a6b70abb09b6fd78dfd3b11e5279ab8a8c2c0cc572cc3aaa84f435cd502","from":"sha256:549533784db7d1bc8af27ae12552b99737b7191d3b75c5f0f101986f468f0f51","Type":"container","Action":"destroy","Actor":{"ID":"869a9a6b70abb09b6fd78dfd3b11e5279ab8a8c2c0cc572cc3aaa84f435cd502","Attributes":{"image":"sha256:549533784db7d1bc8af27ae12552b99737b7191d3b75c5f0f101986f468f0f51","name":"silly_antonelli"}},"scope":"local","time":1636413669,"timeNano":1636413669164488868}
       ---> Running in fd2cd7633f9e
      Docker event: {"status":"create","id":"fd2cd7633f9e9eb6f2df062cfb6587d6802a118febdcf300a6ef7fcfc25b07be","from":"sha256:ea3f0ec9718aa5d29021b755b489ffb7ab5cde1fc26d8805ac9ede84ef900740","Type":"container","Action":"create","Actor":{"ID":"fd2cd7633f9e9eb6f2df062cfb6587d6802a118febdcf300a6ef7fcfc25b07be","Attributes":{"image":"sha256:ea3f0ec9718aa5d29021b755b489ffb7ab5cde1fc26d8805ac9ede84ef900740","name":"wizardly_elbakyan"}},"scope":"local","time":1636413669,"timeNano":1636413669232030425}
      Docker event: {"status":"attach","id":"fd2cd7633f9e9eb6f2df062cfb6587d6802a118febdcf300a6ef7fcfc25b07be","from":"sha256:ea3f0ec9718aa5d29021b755b489ffb7ab5cde1fc26d8805ac9ede84ef900740","Type":"container","Action":"attach","Actor":{"ID":"fd2cd7633f9e9eb6f2df062cfb6587d6802a118febdcf300a6ef7fcfc25b07be","Attributes":{"image":"sha256:ea3f0ec9718aa5d29021b755b489ffb7ab5cde1fc26d8805ac9ede84ef900740","name":"wizardly_elbakyan"}},"scope":"local","time":1636413669,"timeNano":1636413669232237774}
      Docker event: {"status":"start","id":"fd2cd7633f9e9eb6f2df062cfb6587d6802a118febdcf300a6ef7fcfc25b07be","from":"sha256:ea3f0ec9718aa5d29021b755b489ffb7ab5cde1fc26d8805ac9ede84ef900740","Type":"container","Action":"start","Actor":{"ID":"fd2cd7633f9e9eb6f2df062cfb6587d6802a118febdcf300a6ef7fcfc25b07be","Attributes":{"image":"sha256:ea3f0ec9718aa5d29021b755b489ffb7ab5cde1fc26d8805ac9ede84ef900740","name":"wizardly_elbakyan"}},"scope":"local","time":1636413669,"timeNano":1636413669574048129}
      SonarScanner for MSBuild 5.3.2
      Using the .NET Core version of the Scanner for MSBuild
      Post-processing started.
      Calling the SonarScanner CLI...
      Scanner configuration file: /root/.dotnet/tools/.store/dotnet-sonarscanner/5.3.2/dotnet-sonarscanner/5.3.2/tools/netcoreapp3.0/any/sonar-scanner-4.6.2.2472/conf/sonar-scanner.properties
      Project root configuration file: /home/tcservice/buildAgent/work/59055310711a86a1/.sonarqube/out/sonar-project.properties
      SonarScanner 4.6.2.2472
      Java 11.0.13 Oracle Corporation (64-bit)
      Linux 4.15.0-156-generic amd64
      User cache: /root/.sonar/cache
      Scanner configuration file: /root/.dotnet/tools/.store/dotnet-sonarscanner/5.3.2/dotnet-sonarscanner/5.3.2/tools/netcoreapp3.0/any/sonar-scanner-4.6.2.2472/conf/sonar-scanner.properties
      Project root configuration file: /home/tcservice/buildAgent/work/59055310711a86a1/.sonarqube/out/sonar-project.properties
      Analyzing on SonarQube server 9.1.0
      Default locale: "en_US", source code encoding: "US-ASCII" (analysis is platform dependent)
      Load global settings
      Load global settings (done) | time=88ms
      Server id: 0F42DFE6-AVkkllZrrqXKE7wEKcq3
      User cache: /root/.sonar/cache
      Load/download plugins
      Load plugins index
      Load plugins index (done) | time=50ms
      Load/download plugins (done) | time=4673ms
      Loaded core extensions: developer-scanner
      Process project properties
      Process project properties (done) | time=27ms
      Execute project builders
      Execute project builders (done) | time=44ms
      Project key: plentyofcode_Matching
      Base dir: /home/tcservice/buildAgent/work/59055310711a86a1
      Working dir: /home/tcservice/buildAgent/work/59055310711a86a1/.sonarqube/out/.sonar
      Load project settings for component key: 'plentyofcode_Matching' (done) | time=54ms
      Load project branches (done) | time=45ms
      Load project pull requests (done) | time=56ms
      Found manual configuration of branch/PR analysis. Skipping automatic configuration.
      Load branch configuration (done) | time=3ms
      Load quality profiles (done) | time=102ms
      Load active rules (done) | time=2792ms
      Pull request 3 for merge into release/2.3.0 from PR1-Test
      SCM collecting changed files in the branch
      ------------------------------------------------------------------------
      EXECUTION FAILURE
      ------------------------------------------------------------------------
      Total time: 9.815s
      Final Memory: 6M/34M
      ------------------------------------------------------------------------
       [91mERROR: Error during SonarScanner execution
       [0m [91mERROR: Not inside a Git work tree: /home/tcservice/buildAgent/work/59055310711a86a1
       [0m [91mERROR: 
       [0m [91mThe SonarScanner did not complete successfully

还尝试将基目录设置为 checkout 目录内的子目录,但也不起作用。
请帮助!为什么声纳分析没有检测到.git文件?

pwuypxnk

pwuypxnk1#

我忘了我问过这个问题。几周后,我重新访问了这个问题。问题是我的应用程序的**.dockerignore**文件上有 .git。从那里删除它后,SCM提供程序自动检测又开始工作了。

相关问题