JK
This commit is contained in:
parent
4fe54e8bc7
commit
fa4dadc8ba
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@ -130,32 +130,35 @@ pipeline {
|
|||||||
dotnet tool update --global dotnet-sonarscanner
|
dotnet tool update --global dotnet-sonarscanner
|
||||||
export PATH="$PATH:/root/.dotnet/tools"
|
export PATH="$PATH:/root/.dotnet/tools"
|
||||||
|
|
||||||
# BEGIN
|
# Optional: show Java & reachability
|
||||||
|
java -version || true
|
||||||
|
curl -sf "$SONAR_HOST_URL/api/system/health" || { echo "Cannot reach SonarQube at $SONAR_HOST_URL"; exit 1; }
|
||||||
|
|
||||||
|
# BEGIN (use injected URL/token; add verbose for diagnostics)
|
||||||
dotnet sonarscanner begin \
|
dotnet sonarscanner begin \
|
||||||
/k:AS400API \
|
/k:AS400API \
|
||||||
/d:sonar.host.url=$SONAR_HOST_URL \
|
/d:sonar.verbose=true \
|
||||||
/d:sonar.login=$SONAR_AUTH_TOKEN \
|
|
||||||
/d:sonar.exclusions=**/bin/**,**/obj/** \
|
/d:sonar.exclusions=**/bin/**,**/obj/** \
|
||||||
/d:sonar.test.exclusions=**/*.Tests/** \
|
/d:sonar.test.exclusions=**/*.Tests/** \
|
||||||
/d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
|
/d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
|
||||||
|
|
||||||
# BUILD & TEST (generate coverage if you want it on Sonar)
|
# BUILD & TEST (produce OpenCover report)
|
||||||
dotnet restore
|
dotnet restore
|
||||||
dotnet build -c Release
|
dotnet build -c Release
|
||||||
dotnet test AS400API.Tests/AS400API.Tests.csproj -c Release \
|
dotnet test AS400API.Tests/AS400API.Tests.csproj -c Release \
|
||||||
/p:CollectCoverage=true \
|
/p:CollectCoverage=true \
|
||||||
/p:CoverletOutput=./TestResults/coverage/ \
|
/p:CoverletOutput=./TestResults/coverage/ \
|
||||||
/p:CoverletOutputFormat=\"opencover\"
|
/p:CoverletOutputFormat=opencover
|
||||||
|
|
||||||
# END (must be inside withSonarQubeEnv so it can create report-task.txt)
|
# END (no login flag; uses env from withSonarQubeEnv)
|
||||||
dotnet sonarscanner end /d:sonar.login=$SONAR_AUTH_TOKEN
|
dotnet sonarscanner end /d:sonar.verbose=true
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
// Optionally wait for Quality Gate
|
|
||||||
|
// Optionally wait for the Quality Gate (only if 'end' succeeds)
|
||||||
// waitForQualityGate abortPipeline: true
|
// waitForQualityGate abortPipeline: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Test + Coverage') {
|
stage('Test + Coverage') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user