0

used software:

  1. SonarQube 7.6
  2. nuget dotnet-sonarscanner https://www.nuget.org/packages/dotnet-sonarscanner,
  3. TFS on prem

We are using SonarQube and the dotnet-sonarscanner from nuget which works great. Unfortunately, we are not able to get the information about the sonarqube scan and quality gates back to TFS.

We want to prevent PullRequests from being merged if the quality gate is not passed. I understood that you don't want to break the build anymore if the quality gate is broken.

I found something on the documentation (https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Extension+for+VSTS-TFS) but I am not finding the mentioned settings like “Administration -> General Settings -> Pull Requests”

The background is that we use the sonarqube scanner within our docker builds:

dotnet tool install --global dotnet-sonarscanner --version 4.4.2
apt-get -yqq update && apt-get -yqq install openjdk-8-jre-headless > /dev/null


dotnet-sonarscanner begin /k:$BUILD_NAME /d:sonar.host.url="$SONAR_HOST" /d:sonar.login="$SONAR_LOGIN" /d:sonar.exclusions="**/bin/**/*,**/obj/**/*" /d:sonar.cs.opencover.reportsPaths=/src/opencover.xml /v:$BUILD_ID


dotnet build $UNITTEST_PROJECT
coverlet $UNITTEST_ASSEMBLY --target "dotnet" --targetargs "test $UNITTEST_PROJECT --no-build" --output /src/opencover.xml --format opencover
dotnet publish $PROJECT -c Release -o /app


dotnet-sonarscanner end /d:sonar.login="$SONAR_LOGIN"
aumanjoa
  • 905
  • 1
  • 11
  • 30

1 Answers1

-1

We want to prevent PullRequests from being merged if the quality gate is not passed.

Then have failing quality gates fail the build.

I understood that you don't want to break the build anymore if the quality gate is broken.

Why not? You're saying that you do want the quality gate to be a blocker, so it should cause the build to fail.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • sorry my comment about "I understood you dont want to break the build" was ment sonarqube team decided to not break the build anymore if the quality gate breaks. "then have failling quality gates fail the build" how is this possible. that is exactly what I want – aumanjoa Feb 28 '19 at 14:44