From 27b005b4ea431ab09900843996b179ec3cd66eda Mon Sep 17 00:00:00 2001 From: Max Nuding Date: Fri, 10 Nov 2023 18:58:06 +0100 Subject: [PATCH] configure sonarqube scanner --- Jenkinsfile | 19 +++++++++++-------- sonar-project.properties | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 sonar-project.properties diff --git a/Jenkinsfile b/Jenkinsfile index 5b4bcc7..575a225 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 + """ } } } diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..b3b5ea8 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +community.rust.clippy.reportPaths=clippy-output.json \ No newline at end of file