From 644e44cf42623bcf78d1ac97d87691f25369272d Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Wed, 24 Feb 2021 15:56:02 +0100
Subject: [PATCH] OZG-199 sonarqube auf master begrenzen

---
 Jenkinsfile               | 24 ++++++++++++++++--------
 goofy-client/package.json |  2 +-
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 6ac04623df..a8b1efd39a 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -34,8 +34,13 @@ pipeline {
                             else {
                                 sh 'npm run ci-build'
                             }
-                            withSonarQubeEnv('sonarqube'){
-                                sh 'npm run ci-sonar'
+
+                            sh 'npm run ci-test'
+
+                            if (env.BRANCH_NAME == 'master') {
+                                withSonarQubeEnv('sonarqube'){
+                                    sh 'npm run ci-sonar'
+                                }
                             }
                         }
                     }
@@ -54,13 +59,16 @@ pipeline {
                     FAILED_STAGE=env.STAGE_NAME
                 }
                 container("maven-11"){
-                    withSonarQubeEnv('sonarqube'){
-                        configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) {
-	                        sh 'mvn --version'
-    	                    sh 'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install'
+                    configFileProvider([configFile(fileId: '9aac2fac-7d8d-4128-846b-0a61951df703', variable: 'MAVEN_SETTINGS')]) {
+                        sh 'mvn --version'
+                        sh 'mvn -s $MAVEN_SETTINGS -pl -goofy-client clean install'
+
+                        if (env.BRANCH_NAME == 'master') {
     	                    dir('goofy-server'){
-        	                    sh 'mvn sonar:sonar'
-    	                    }
+                                withSonarQubeEnv('sonarqube'){
+                                    sh 'mvn sonar:sonar'
+                                }
+                            }
 		                }
                     }
                 }
diff --git a/goofy-client/package.json b/goofy-client/package.json
index b5a012a554..fcac71a00b 100644
--- a/goofy-client/package.json
+++ b/goofy-client/package.json
@@ -16,7 +16,7 @@
     "ci-build": "ng build --outputHashing=all",
     "ci-prodBuild": "ng build --prod --outputHashing=all",
     "ci-test": "jest test a --ci --coverage --testResultsProcessor='jest-sonar-reporter'",
-    "ci-sonar": "npm run ci-test && sonar-scanner",
+    "ci-sonar": "sonar-scanner",
     "lint": "nx workspace-lint && ng lint",
     "affected:apps": "nx affected:apps",
     "affected:libs": "nx affected:libs",
-- 
GitLab