pipeline { agent { node { label 'jenkins_homer_agent' } } stages { stage('Build') { environment { dotnet ="C:\\Program Files\\dotnet\\" } steps { cleanWs() checkout scm bat "dotnet restore Hochbaustatistik.sln" bat "\"${tool 'MSBuild17'}\" ${WORKSPACE}\\Hochbaustatistik.sln /t:Restore /t:Rebuild /p:Configuration=Debug" } } stage('Test') { environment { dotnet ="C:\\Program Files\\dotnet\\" } steps { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { bat "dotnet test ${WORKSPACE}\\Hochbaustatistik.Testing\\Hochbaustatistik.Testing.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=..\\..\\coverage.xml /p:Exclude=[Scan2Compress.GUI]*%2c[Scan2Compress.Properties]* --no-build" } } } stage('SonarQube') { environment { scannerHome = tool 'sonar-scanner4.4' project = 'hochbaustatistik' token = 'sqa_07d4e3802cf6283fc38a002e75bd0a5eb158af87' } steps { withSonarQubeEnv('SonarQube_Homer') { bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${project} -Dsonar.login=${token}" } } } } }