You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/04/18 08:53:46 UTC

[sling-tooling-jenkins] branch master updated: SLING-8358 - Build should not fail if a project is not onboarded to SonarCloud

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git


The following commit(s) were added to refs/heads/master by this push:
     new a899594  SLING-8358 - Build should not fail if a project is not onboarded to SonarCloud
a899594 is described below

commit a899594f65f91c3b2de5860ff4dc4e536bf908ea
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Apr 18 11:53:23 2019 +0300

    SLING-8358 - Build should not fail if a project is not onboarded to SonarCloud
---
 vars/slingOsgiBundleBuild.groovy | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index 8c77483..2ed02c8 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -48,7 +48,14 @@ def call(Map params = [:]) {
                         withMaven(maven: globalConfig.mvnVersion, 
                             jdk: jenkinsJdkLabel(jobConfig.jdks[0], globalConfig),
                             publisherStrategy: 'EXPLICIT') {
-                            sh "mvn -U clean verify sonar:sonar ${sonarcloudParams}"
+                                try {
+                                    sh "mvn -U clean verify sonar:sonar ${sonarcloudParams}"
+                                } catch ( Exception e ) {
+                                    if ( e.getMessage().contains("not authorized to run analysis")) {
+                                        echo "Marking build unstable due to missing SonarCloud onboarding. See https://cwiki.apache.org/confluence/display/SLING/SonarCloud+analysis for steps to fix."
+                                        currentBuild.result = "UNSTABLE"
+                                    }
+                                }
                         }
                     }
                 }