Last active
February 2, 2024 22:57
-
-
Save mwwhited/0c5ce115d0f998db09351252f5adafa2 to your computer and use it in GitHub Desktop.
Local SonarQube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET SONARQUBE_KEY=XXX | |
SET SONARQUBE_TOKEN=YYY | |
dotnet tool restore | |
echo "Git fetch" | |
git fetch --prune | |
FOR /F "tokens=* USEBACKQ" %%g IN (`dotnet gitversion /output json /showvariable FullSemVer`) DO (SET BUILD_VERSION=%%g) | |
if "%BUILD_VERSION%"=="" GOTO error | |
ECHO Building Version= "%BUILD_VERSION%" | |
dotnet sonarscanner begin ^ | |
/k:"%SONARQUBE_KEY%" ^ | |
/d:sonar.host.url="http://localhost:9000" ^ | |
/d:sonar.token="%SONARQUBE_TOKEN%" ^ | |
/d:sonar.cs.vscoveragexml.reportsPaths=.\TestResults\coverage.xml ^ | |
/v:"%BUILD_VERSION%" | |
RMDIR /S .\TestResults | |
CALL build.bat | |
dotnet coverage collect "dotnet test" -f xml -o ".\TestResults\coverage.xml" | |
dotnet sonarscanner end ^ | |
/d:sonar.token="%SONARQUBE_TOKEN%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run ^ | |
--detach ^ | |
--name sonarqube ^ | |
--env SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true ^ | |
--publish 9000:9000 ^ | |
--volume %cd%\..\..\sonarqube\data:/opt/sonarqube/data ^ | |
--volume %cd%\..\..\sonarqube\extensions:/opt/sonarqube/extensions ^ | |
--volume %cd%\..\..\sonarqube\logs:/opt/sonarqube/logs ^ | |
sonarqube:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment