configure sonarqube scanner

This commit is contained in:
Max Nuding 2023-11-10 18:58:06 +01:00
parent 4ccaf9976a
commit 27b005b4ea
No known key found for this signature in database
2 changed files with 12 additions and 8 deletions

19
Jenkinsfile vendored
View File

@ -7,13 +7,12 @@ pipeline {
triggers {
pollSCM("*/10 * * * *")
}
/*
environment {
MSBUILD_SQ_SCANNER_HOME = tool name: 'sonarscanner', type: 'hudson.plugins.sonar.MsBuildSQRunnerInstallation'
DOTNET_USE_POLLING_FILE_WATCHER = true
DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE = false
SONAR_SCANNER_VERSION=4.7.0.2747
SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
PATH=$SONAR_SCANNER_HOME/bin:$PATH
SONAR_SCANNER_OPTS="-server"
}
*/
stages {
stage('Checkout'){
steps{
@ -23,14 +22,14 @@ pipeline {
}
stage('Clean'){
steps {
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) {
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) { // Cargo needs to be installed for the jenkins user
sh 'cargo clean'
}
}
}
stage('Build'){
steps {
withSonarQubeEnv(installationName: 'grover.local:9000', envOnly: true) {
withSonarQubeEnv(installationName: 'SQ Bib Watcher', envOnly: true) {
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) {
sh 'cargo build --release'
}
@ -41,7 +40,11 @@ pipeline {
stage('SonarQube Analysis') {
steps {
withSonarQubeEnv('grover.local:9000') {
sh "dotnet ${MSBUILD_SQ_SCANNER_HOME}/SonarScanner.MSBuild.dll end"
sh """
printenv
cargo clippy --message-format=json &> clippy-output.json
sonar-scanner -Dsonar.projectKey=bib-watcher -Dsonar.sources=. -Dsonar.host.url=http://grover.local:9000
"""
}
}
}

1
sonar-project.properties Normal file
View File

@ -0,0 +1 @@
community.rust.clippy.reportPaths=clippy-output.json