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 { triggers {
pollSCM("*/10 * * * *") pollSCM("*/10 * * * *")
} }
/*
environment { environment {
MSBUILD_SQ_SCANNER_HOME = tool name: 'sonarscanner', type: 'hudson.plugins.sonar.MsBuildSQRunnerInstallation' SONAR_SCANNER_VERSION=4.7.0.2747
DOTNET_USE_POLLING_FILE_WATCHER = true SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE = false PATH=$SONAR_SCANNER_HOME/bin:$PATH
SONAR_SCANNER_OPTS="-server"
} }
*/
stages { stages {
stage('Checkout'){ stage('Checkout'){
steps{ steps{
@ -23,14 +22,14 @@ pipeline {
} }
stage('Clean'){ stage('Clean'){
steps { 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' sh 'cargo clean'
} }
} }
} }
stage('Build'){ stage('Build'){
steps { steps {
withSonarQubeEnv(installationName: 'grover.local:9000', envOnly: true) { withSonarQubeEnv(installationName: 'SQ Bib Watcher', envOnly: true) {
withEnv(["PATH+RUST=$HOME/.cargo/bin"]) { withEnv(["PATH+RUST=$HOME/.cargo/bin"]) {
sh 'cargo build --release' sh 'cargo build --release'
} }
@ -41,7 +40,11 @@ pipeline {
stage('SonarQube Analysis') { stage('SonarQube Analysis') {
steps { steps {
withSonarQubeEnv('grover.local:9000') { 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