This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.1 by this push:
new b6849441a5 Try add sonarcloud (#10906)
b6849441a5 is described below
commit b6849441a5c6ae79cce36147521cedceb8f26f86
Author: Albumen Kevin <[email protected]>
AuthorDate: Thu Nov 10 15:06:47 2022 +0800
Try add sonarcloud (#10906)
---
Jenkinsfile.sonar | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/Jenkinsfile.sonar b/Jenkinsfile.sonar
new file mode 100644
index 0000000000..b16366afb0
--- /dev/null
+++ b/Jenkinsfile.sonar
@@ -0,0 +1,49 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+pipeline {
+ agent any
+
+ tools {
+ maven 'maven_3_latest'
+ jdk 'jdk_11_latest'
+ }
+
+ stages {
+ stage('Code Quality') {
+ steps {
+ echo 'Checking Code Quality on SonarCloud'
+ script {
+ // Main parameters
+ def sonarcloudParams=""
+ if ( env.BRANCH_NAME.startsWith("PR-") ) {
+ // this is a pull request
+ withCredentials([string(credentialsId:
'sonarcloud-token', variable: 'SONAR_TOKEN')]) {
+ sh 'mvn --batch-mode --no-snapshot-updates -e
--no-transfer-progress --fail-fast clean verify sonar:sonar -Pjacoco
-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache
-Dsonar.projectKey=apache_dubbo -Dsonar.pullrequest.branch=${CHANGE_BRANCH}
-Dsonar.pullrequest.base=${CHANGE_TARGET} -Dsonar.pullrequest.key=${CHANGE_ID}
-Dsonar.login=${SONAR_TOKEN}'
+ }
+ } else {
+ // this is just a branch
+ withCredentials([string(credentialsId:
'sonarcloud-token', variable: 'SONAR_TOKEN')]) {
+ sh 'mvn --batch-mode --no-snapshot-updates -e
--no-transfer-progress --fail-fast clean verify sonar:sonar -Pjacoco
-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache
-Dsonar.projectKey=apache_dubbo -Dsonar.branch.name=${BRANCH_NAME}
-Dsonar.login=${SONAR_TOKEN}'
+ }
+ }
+ }
+ }
+ }
+ }
+}