From 8e2fd0f03561ba58ae92ef55621a40347a497202 Mon Sep 17 00:00:00 2001 From: Alois Zoitl Date: Tue, 12 Dec 2023 21:15:06 +0100 Subject: [PATCH] Bring back sonar build to jenkins file --- Jenkinsfile | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6881ce7f4..65b9310cb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,19 +11,27 @@ pipeline { maven 'apache-maven-latest' jdk 'openjdk-jdk17-latest' } + environment { + SONARCLOUD_TOKEN = credentials('SonarCloud token for gef') + } stages { stage('Build') { steps { - wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) { - sh ''' - export GDK_BACKEND=x11 - mvn clean verify -Dmaven.repo.local=$WORKSPACE/.m2/repository \ - -DapiBaselineTargetDirectory=${WORKSPACE} \ - -Dgpg.passphrase="${KEYRING_PASSPHRASE}" \ - -Dproject.build.sourceEncoding=UTF-8 \ - -Peclipse-sign - ''' + withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SonarCloud token for gef')]) { + withSonarQubeEnv(credentialsId: 'sonarcloud-token', installationName: 'GEF Classic') { + wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) { + sh ''' + export GDK_BACKEND=x11 + mvn clean verify -Dmaven.repo.local=$WORKSPACE/.m2/repository \ + -DapiBaselineTargetDirectory=${WORKSPACE} \ + -Dgpg.passphrase="${KEYRING_PASSPHRASE}" \ + -Dproject.build.sourceEncoding=UTF-8 \ + -Peclipse-sign \ + -B sonar:sonar -Dsonar.projectKey=gef-classic -Dsonar.organization=eclipse -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONARCLOUD_TOKEN} + ''' + } + } } } post {