From 94dc1cb5296da4880b43d8c462aa6146aebd9e1b Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 28 Jul 2021 14:21:54 +0200 Subject: [PATCH] call of sonar qube in try-catch block to prevent build breaks --- Jenkinsfile | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed14936bf8..4840ef5c4f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,10 +40,14 @@ pipeline { sh 'npm run ci-test' - if (env.BRANCH_NAME == 'master') { - withSonarQubeEnv('sonarqube-ozg-sh'){ - sh 'npm run ci-sonar' - } + try { + if (env.BRANCH_NAME == 'master') { + withSonarQubeEnv('sonarqube-ozg-sh'){ + sh 'npm run ci-sonar' + } + } + } catch (Exception e) { + unstable("SonarQube failed") } } } @@ -68,13 +72,17 @@ pipeline { } script { - if (env.BRANCH_NAME == 'master') { - dir('goofy-server'){ - withSonarQubeEnv('sonarqube-ozg-sh'){ - sh 'mvn sonar:sonar' - } - } - } + try { + if (env.BRANCH_NAME == 'master') { + dir('goofy-server'){ + withSonarQubeEnv('sonarqube-ozg-sh'){ + sh 'mvn sonar:sonar' + } + } + } + } catch (Exception e) { + unstable("SonarQube failed") + } } } } -- GitLab