You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/12/12 04:19:29 UTC

[incubator-iotdb] 01/01: enable Sonarcloud

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

hxd pushed a commit to branch enable_sonar
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit f9ff1960153a18ce7d63e54c7e69ead89b31e7c6
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Thu Dec 12 12:18:59 2019 +0800

    enable Sonarcloud
---
 Jenkinsfile | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/Jenkinsfile b/Jenkinsfile
index efd3710..28ab77f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -106,6 +106,27 @@ pipeline {
 //            }
 //        }
 
+        stage('Code Quality') {
+            steps {
+                echo 'Checking Code Quality on SonarCloud'
+                // Main parameters
+                def sonarcloudParams="-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_incubator-iotdb"
+                if ( env.BRANCH_NAME.startsWith("PR-") ) {
+                    // this is a pull request
+                    sonarcloudParams="${sonarcloudParams} -Dsonar.pullrequest.branch=${CHANGE_BRANCH} -Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID}"
+                } else if (env.BRANCH_NAME.equals("master")) {
+                    // this is just a branch
+                    sonarcloudParams="${sonarcloudParams} -Dsonar.branch.name=${BRANCH_NAME}"
+                }
+                // Then run the analysis
+                // 'my-sonarcloud-token' needs to be defined for this job and contains the user token
+                withCredentials([string(credentialsId: 'xiangdong-iotdb-sonarcloud-token', variable: 'SONAR_TOKEN')]) {
+                    sh 'mvn clean verify sonar:sonar ${sonarcloudParams} -Dsonar.login=${SONAR_TOKEN}'
+                }
+            }
+        }
+
+
         stage('Deploy') {
             when {
                 branch 'master'