SonarQube Version:
Deployment: docker
Problem
I have set up a GitHub action to run the scanner. On first run the scanner executes successfully and reports analysis on the dashboard. However on subsequent runs, the action runs successfully, quality gate passes but this time no code is reported and it shows the quality gate passed but no other info
checking the code shows no lines of code
The GitHub action step is as follows:
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"${{env.BACKEND_PROJECT_KEY}}" /n:"${{env.BACKEND_PROJECT_NAME}}" /d:sonar.verbose=true /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.qualitygate.wait=true /d:sonar.scm.exclusions.disabled=true
dotnet build ${{env.BACKEND_WORKING_DIRECTORY}}
dotnet-coverage collect dotnet test ${{env.BACKEND_WORKING_DIRECTORY}} -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
The logs after scanning are:
10:21:12.591 INFO: Analysis report uploaded in 294ms
10:21:12.592 DEBUG: Report metadata written to D:\a\<REDUCTED>\.sonarqube\out\.sonar\report-task.txt
10:21:12.592 INFO: ------------- Check Quality Gate status
10:21:12.593 INFO: Waiting for the analysis report to be processed (max 300s)
10:21:12.698 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=104ms
10:21:17.808 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=104ms
10:21:22.911 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=102ms
10:21:28.014 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=101ms
10:21:33.123 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=104ms
10:21:38.239 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=114ms
10:21:43.353 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=111ms
10:21:48.460 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=104ms
10:21:53.565 DEBUG: GET 200 ***/api/ce/task?id=<REDUCTED>\ | time=104ms
10:21:53.670 DEBUG: GET 200 ***/api/qualitygates/project_status?analysisId=<REDUCTED>\ | time=105ms
10:21:53.681 INFO: QUALITY GATE STATUS: PASSED - View details on ***/dashboard?id=<REDUCTED>\
10:21:53.686 DEBUG: Post-jobs :
10:21:53.692 INFO: Analysis total time: 51.217 s