From f0402df915ba59b3dba128fe52ee9e9ab6f8313e Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Thu, 6 Dec 2018 17:03:19 -0700 Subject: [PATCH] Split Branches Into Multiple Sonarqube Projects Eliminate analysis collisions and simplify application of analysis quite periods. Fixes: gh-6091 --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3bd9c289c2..88c32258ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,7 +30,11 @@ try { checkout scm withCredentials([string(credentialsId: 'spring-sonar.login', variable: 'SONAR_LOGIN')]) { try { - sh "./gradlew sonarqube -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace" + if ("master" == env.BRANCH_NAME) { + sh "./gradlew sonarqube -PexcludeProjects='**/samples/**' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace" + } else { + sh "./gradlew sonarqube -PexcludeProjects='**/samples/**' -Dsonar.projectKey='spring-security-${env.BRANCH_NAME}' -Dsonar.projectName='spring-security-${env.BRANCH_NAME}' -Dsonar.host.url=$SPRING_SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN --refresh-dependencies --no-daemon --stacktrace" + } } catch(Exception e) { currentBuild.result = 'FAILED: sonar' throw e