Thank you Colin for your reply.
Below is the github actions workflow that we have added.
- name: SonarQube Begin
run: |
#dotnet add package coverlet.collector --version 3.2.0
dotnet tool install --global coverlet.console
dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /k:"***************"
/d:sonar.login=${{ secrets.SONAR_TOKEN }}
/d:$GITHUB_WORKSPACE/SonarQube.Analysis.xml
/d:sonar.verbose=true
/d:sonar.cs.vscoveragexml.reportsPaths=./tst/Infrastructure.Tests/TestResults/coverage.xml
/d:sonar.verbose=true
dotnet build --no-incremental /d:sonar.verbose=true
coverlet .\tst\Infrastructure.Tests\bin\Debug\net6.0\Infrastructure.Tests.dll
--target "dotnet" --targetagrs "test --no-build" -f=opencover -o="coverage.xml"
/d:sonar.verbose=true
- name: Build
run: dotnet build
- name: SonarQube end
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}'
I am seeing the below error message when I run the github actions workflow:
Preparing working directories…
14:19:55.635 Updating build integration targets…
14:19:55.736 Failed to request and parse ‘http://localhost:9000/api/server/version’: Connection refused (localhost:9000)
Unhandled exception. System.Net.Http.HttpRequestException: Connection refused (localhost:9000)
—> System.Net.Sockets.SocketException (111): Connection refused
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
— End of inner exception stack trace —
We are not sure why we are seeing error : Failed to request and parse ‘http://localhost:9000/api/server/version’: Connection refused (localhost:9000) only for this specific workflow.
Our " SonarQube.Analysis.xml" is defined as below :
<?xml version="1.0" encoding="utf-8" ?>
<SonarQubeAnalysisProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<Property Name="sonar.host.url">https://***************/</Property>
<Property Name="/d:sonar.cs.opencover.reportsPaths=">./tst/Infrastructure.Tests/TestResults/coverage.opencover.xml</Property>
</SonarQubeAnalysisProperties>
Could you please help us to resolve the issue.
Thanks,
Anil Kumar