From 3dc60aa83f6ca6e0b60163ad194cede1e8ba9d21 Mon Sep 17 00:00:00 2001 From: Dimitris Gounaris <17044221+dgounaris@users.noreply.github.com> Date: Fri, 3 Apr 2020 15:14:03 +0100 Subject: [PATCH] Make sonarqube step resilient to errors (#6128) Co-authored-by: Dimitris Gounaris --- .ci/dev/regression/Jenkinsfile | 38 ++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/.ci/dev/regression/Jenkinsfile b/.ci/dev/regression/Jenkinsfile index 93dd885ac9..adb34cdfee 100644 --- a/.ci/dev/regression/Jenkinsfile +++ b/.ci/dev/regression/Jenkinsfile @@ -64,23 +64,29 @@ pipeline { stage('Generate sonarqube report') { steps { - // running this step here is the only way to not majorly affect the distributed test plugin, - // as now that neither returns build files nor runs jacoco reports - sh "./gradlew --no-daemon build jacocoRootReport --stacktrace" - withSonarQubeEnv('sq01') { - sh "./gradlew --no-daemon sonarqube -x test --stacktrace" - } - timeout(time: 3, unit: 'MINUTES') { - script { - try { - def qg = waitForQualityGate(); - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { - println('No sonarqube webhook response within timeout. Please check the webhook configuration in sonarqube.') - // continue the pipeline + script { + try { + // running this step here is the only way to not majorly affect the distributed test plugin, + // as now that neither returns build files nor runs jacoco reports + sh "./gradlew --no-daemon build jacocoRootReport --stacktrace" + withSonarQubeEnv('sq01') { + sh "./gradlew --no-daemon sonarqube -x test --stacktrace" } + timeout(time: 3, unit: 'MINUTES') { + script { + try { + def qg = waitForQualityGate(); + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { + println('No sonarqube webhook response within timeout. Please check the webhook configuration in sonarqube.') + // continue the pipeline + } + } + } + } catch (err) { + println('Error while trying to execute sonarqube analysis, will be skipped.') } } }