I am moving the build process of my project to GitHub Actions (see the PR), but I have an http 500 during the end
part of Sonar analysis.
Here are the GitHub workflow for the analysis based on the set up for .net project on sonarcloud.io:
name: Sonar Analysis
on:
push:
branches:
- master
pull_request:
jobs:
sonarcloud:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Test
run: dotnet test src --configuration Release --nologo --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"laedit_vika" /o:"laedit-github" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" -d:sonar.cs.opencover.reportsPaths=NVika.Tests/coverage.opencover.xml /d:sonar.coverage.exclusions="NVika.Tests/*" /d:sonar.verbose=true
dotnet build src --configuration Release
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
And here the log of the sonar analysis part:
##[group]Run .\.sonar\scanner\dotnet-sonarscanner begin /k:"laedit_vika" /o:"laedit-github" /d:sonar.login="***" /d:sonar.host.url="https://sonarcloud.io" -d:sonar.cs.opencover.reportsPaths=NVika.Tests/coverage.opencover.xml /d:sonar.coverage.exclusions="NVika.Tests/*"
2020-10-21T03:54:36.0662065Z e[36;1m.\.sonar\scanner\dotnet-sonarscanner begin /k:"laedit_vika" /o:"laedit-github" /d:sonar.login="***" /d:sonar.host.url="https://sonarcloud.io" -d:sonar.cs.opencover.reportsPaths=NVika.Tests/coverage.opencover.xml /d:sonar.coverage.exclusions="NVika.Tests/*"e[0m
2020-10-21T03:54:36.0663704Z e[36;1mdotnet build src --configuration Releasee[0m
2020-10-21T03:54:36.0664504Z e[36;1m.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="***"e[0m
2020-10-21T03:54:36.0707702Z shell: C:\windows\System32\WindowsPowerShell\v1.0\powershell.EXE -command ". '{0}'"
2020-10-21T03:54:36.0708335Z env:
2020-10-21T03:54:36.0709225Z GITHUB_TOKEN: ***
2020-10-21T03:54:36.0709776Z SONAR_TOKEN: ***
2020-10-21T03:54:36.0710053Z ##[endgroup]
2020-10-21T03:54:36.3264621Z SonarScanner for MSBuild 4.10
2020-10-21T03:54:36.3266955Z Using the .NET Core version of the Scanner for MSBuild
2020-10-21T03:54:36.4090271Z Pre-processing started.
2020-10-21T03:54:36.4105256Z Preparing working directories...
2020-10-21T03:54:36.4294306Z 03:54:36.429 Updating build integration targets...
2020-10-21T03:54:36.4529731Z 03:54:36.452 Fetching analysis configuration settings...
2020-10-21T03:54:39.6239249Z 03:54:39.623 Provisioning analyzer assemblies for cs...
2020-10-21T03:54:39.6248563Z 03:54:39.624 Installing required Roslyn analyzers...
2020-10-21T03:54:43.8388854Z 03:54:43.838 Provisioning analyzer assemblies for vbnet...
2020-10-21T03:54:43.8390442Z 03:54:43.838 Installing required Roslyn analyzers...
2020-10-21T03:54:43.8650709Z 03:54:43.864 Pre-processing succeeded.
2020-10-21T03:54:44.1703871Z Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
2020-10-21T03:54:44.1704801Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-10-21T03:54:44.1705263Z
2020-10-21T03:54:44.9341287Z Determining projects to restore...
2020-10-21T03:54:45.3481120Z All projects are up-to-date for restore.
2020-10-21T03:54:49.5506586Z Exceptions\NVikaException.cs(6,29): warning S3871: Make this exception 'public'. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:49.5511302Z Program.cs(86,30): warning S4792: Make sure that this logger's configuration is safe. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:49.5536148Z BuildServers\AppVeyor.cs(48,13): warning CC0120: Consider put an default clause in Switch. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:49.5538499Z Parsers\SarifParser.cs(37,44): warning S3776: Refactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:49.5540666Z ParseReportCommand.cs(42,42): warning S927: Rename parameter 'reportPaths' to 'remainingArguments' to match the base class declaration. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:49.5542242Z Parsers\GendarmeParser.cs(67,17): warning S4524: Move this 'default:' case to the beginning or end of this 'switch' statement. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:49.5886846Z NVika -> D:\a\vika\vika\src\NVika\bin\Release\netcoreapp3.1\NVika.dll
2020-10-21T03:54:49.6329876Z Sonar: (NVika.csproj) Project processed successfully
2020-10-21T03:54:50.3118961Z Successfully created package 'D:\a\vika\vika\src\NVika\bin\Release\NVika.1.0.0.nupkg'.
2020-10-21T03:54:51.5461603Z NVika.Tests -> D:\a\vika\vika\src\NVika.Tests\bin\Release\netcoreapp3.1\NVika.Tests.dll
2020-10-21T03:54:51.5982246Z Sonar: (NVika.Tests.csproj) Project processed successfully
2020-10-21T03:54:51.6052485Z
2020-10-21T03:54:51.6109952Z Build succeeded.
2020-10-21T03:54:51.6120016Z
2020-10-21T03:54:51.6124578Z Exceptions\NVikaException.cs(6,29): warning S3871: Make this exception 'public'. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:51.6268923Z Program.cs(86,30): warning S4792: Make sure that this logger's configuration is safe. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:51.6278661Z BuildServers\AppVeyor.cs(48,13): warning CC0120: Consider put an default clause in Switch. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:51.6280487Z Parsers\SarifParser.cs(37,44): warning S3776: Refactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:51.6282118Z ParseReportCommand.cs(42,42): warning S927: Rename parameter 'reportPaths' to 'remainingArguments' to match the base class declaration. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:51.6285733Z Parsers\GendarmeParser.cs(67,17): warning S4524: Move this 'default:' case to the beginning or end of this 'switch' statement. [D:\a\vika\vika\src\NVika\NVika.csproj]
2020-10-21T03:54:51.6286881Z 6 Warning(s)
2020-10-21T03:54:51.6289283Z 0 Error(s)
2020-10-21T03:54:51.6289673Z
2020-10-21T03:54:51.6290106Z Time Elapsed 00:00:07.36
2020-10-21T03:54:51.7080779Z SonarScanner for MSBuild 4.10
2020-10-21T03:54:51.7081635Z Using the .NET Core version of the Scanner for MSBuild
2020-10-21T03:54:51.8019569Z Post-processing started.
2020-10-21T03:54:51.9211641Z WARNING: File 'D:\a\vika\vika\resources\icon.png' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9376531Z WARNING: File 'D:\a\vika\vika\LICENSE' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9381878Z WARNING: File 'C:\Users\runneradmin\.nuget\packages\microsoft.net.test.sdk\16.7.1\build\netcoreapp2.1\Microsoft.NET.Test.Sdk.Program.cs' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9391308Z WARNING: File 'C:\Users\runneradmin\.nuget\packages\microsoft.testplatform.testhost\16.7.1\build\netcoreapp2.1\x64\testhost.exe' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9464264Z WARNING: File 'C:\Users\runneradmin\.nuget\packages\microsoft.testplatform.testhost\16.7.1\build\netcoreapp2.1\x64\testhost.dll' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9469097Z WARNING: File 'C:\Users\runneradmin\.nuget\packages\xunit.runner.visualstudio\2.4.3\build\netcoreapp2.1\xunit.runner.visualstudio.dotnetcore.testadapter.dll' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9524994Z WARNING: File 'C:\Users\runneradmin\.nuget\packages\xunit.runner.visualstudio\2.4.3\build\netcoreapp2.1\xunit.runner.reporters.netcoreapp10.dll' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9722012Z WARNING: File 'C:\Users\runneradmin\.nuget\packages\xunit.runner.visualstudio\2.4.3\build\netcoreapp2.1\xunit.runner.utility.netcoreapp10.dll' is not located under the root directory 'D:\a\vika\vika\src' and will not be analyzed.
2020-10-21T03:54:51.9726040Z Calling the SonarQube Scanner...
2020-10-21T03:54:54.6355297Z INFO: Scanner configuration file: D:\a\vika\vika\.sonar\scanner\.store\dotnet-sonarscanner\4.10.0\dotnet-sonarscanner\4.10.0\tools\netcoreapp3.0\any\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
2020-10-21T03:54:54.6418714Z INFO: Project root configuration file: D:\a\vika\vika\.sonarqube\out\sonar-project.properties
2020-10-21T03:54:55.4558926Z INFO: SonarScanner 4.4.0.2170
2020-10-21T03:54:55.4559871Z INFO: Java 1.8.0_265 AdoptOpenJDK (64-bit)
2020-10-21T03:54:55.4560447Z INFO: Windows Server 2019 10.0 amd64
2020-10-21T03:54:58.5545247Z INFO: User cache: C:\Users\runneradmin\.sonar\cache
2020-10-21T03:55:02.3620366Z INFO: Scanner configuration file: D:\a\vika\vika\.sonar\scanner\.store\dotnet-sonarscanner\4.10.0\dotnet-sonarscanner\4.10.0\tools\netcoreapp3.0\any\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
2020-10-21T03:55:02.3622680Z INFO: Project root configuration file: D:\a\vika\vika\.sonarqube\out\sonar-project.properties
2020-10-21T03:55:02.3624111Z INFO: Analyzing on SonarCloud
2020-10-21T03:55:02.3624938Z INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
2020-10-21T03:55:03.8285708Z INFO: Load global settings
2020-10-21T03:55:04.4072089Z INFO: Load global settings (done) | time=572ms
2020-10-21T03:55:04.4074822Z INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
2020-10-21T03:55:04.4144513Z INFO: User cache: C:\Users\runneradmin\.sonar\cache
2020-10-21T03:55:04.4145348Z INFO: Load/download plugins
2020-10-21T03:55:04.4145893Z INFO: Load plugins index
2020-10-21T03:55:04.6631482Z INFO: Load plugins index (done) | time=248ms
2020-10-21T03:55:29.9070696Z INFO: Load/download plugins (done) | time=25493ms
2020-10-21T03:55:31.6813131Z INFO: Loaded core extensions: developer-scanner
2020-10-21T03:55:32.3662579Z INFO: JavaScript/TypeScript frontend is enabled
2020-10-21T03:55:32.6014025Z WARN: The version of Java (1.8.0_265) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11.
2020-10-21T03:55:32.6357961Z INFO: Process project properties
2020-10-21T03:55:32.6358973Z INFO: Execute project builders
2020-10-21T03:55:32.8288943Z INFO: Execute project builders (done) | time=152ms
2020-10-21T03:55:32.9769241Z INFO: Project key: laedit_vika
2020-10-21T03:55:32.9895604Z INFO: Base dir: D:\a\vika\vika\src
2020-10-21T03:55:32.9896788Z INFO: Working dir: D:\a\vika\vika\.sonarqube\out\.sonar
2020-10-21T03:55:33.1445607Z INFO: Load project settings for component key: 'laedit_vika'
2020-10-21T03:55:33.2624200Z INFO: Load project settings for component key: 'laedit_vika' (done) | time=116ms
2020-10-21T03:55:33.2785887Z INFO: Found an active CI vendor: 'Github Actions'
2020-10-21T03:55:33.2786585Z INFO: Load project branches
2020-10-21T03:55:33.4180432Z INFO: Load project branches (done) | time=141ms
2020-10-21T03:55:33.4210368Z INFO: Check ALM binding of project 'laedit_vika'
2020-10-21T03:55:33.5325753Z INFO: Detected project binding: BOUND
2020-10-21T03:55:33.5326705Z INFO: Check ALM binding of project 'laedit_vika' (done) | time=105ms
2020-10-21T03:55:33.5327313Z INFO: Load project pull requests
2020-10-21T03:55:33.6462112Z INFO: Load project pull requests (done) | time=103ms
2020-10-21T03:55:33.6462958Z INFO: Load branch configuration
2020-10-21T03:55:33.6463508Z INFO: Github event: pull_request
2020-10-21T03:55:33.6604307Z INFO: Auto-configuring pull request 246
2020-10-21T03:55:33.7758051Z INFO: ------------------------------------------------------------------------
2020-10-21T03:55:33.7758914Z INFO: EXECUTION FAILURE
2020-10-21T03:55:33.7759428Z INFO: ------------------------------------------------------------------------
2020-10-21T03:55:33.7759913Z INFO: Total time: 39.172s
2020-10-21T03:55:33.8809081Z ERROR: Error during SonarScanner execution
2020-10-21T03:55:33.8809576Z INFO: Final Memory: 34M/379M
2020-10-21T03:55:33.8822274Z ERROR: Something went wrong while trying to get the pullrequest with key '246'
2020-10-21T03:55:33.8823623Z INFO: ------------------------------------------------------------------------
2020-10-21T03:55:33.8824661Z ERROR: Caused by: Error 500 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=laedit_vika&pullrequestKey=246 : {"errors":[{"msg":"An unexpected error occurred. Please try again later."}]}
Full log are here.
I have retried later but no luck.
The SonarCloud application is allowed in the integrations of the project and I have tried
the GitHub Action sonarsource/sonarcloud-github-action@master
with the same result.
I don’t know if this is relevant, but before that I have switched from SonarQube.Runner to SonarScanner on my previous CI AppVeyor and even if the analysis is all green it seems that something went wrong since there is no more code lines:
Is it possible to fix that?
Maybe if I delete and re-import the project?
Thanks!