You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2021/10/07 08:46:53 UTC

[jackrabbit-filevault-jenkins-lib] branch master updated: make SonarCloud project key configurable

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

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-jenkins-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ba6c35  make SonarCloud project key configurable
2ba6c35 is described below

commit 2ba6c359d98344a6c6579ebb521f3d71e047efe5
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Oct 7 10:46:41 2021 +0200

    make SonarCloud project key configurable
---
 README.md                          |  3 ++-
 vars/fileVaultMavenStdBuild.groovy | 12 ++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index dbf1952..0567512 100644
--- a/README.md
+++ b/README.md
@@ -8,10 +8,11 @@ It follows the structure outlined at <https://www.jenkins.io/doc/book/pipeline/s
 It is supposed to be called in a `Jenkinsfile` like this
 
 ```
-fileVaultMavenStdBuild([11, 8, 17], 11, [ "ubuntu", "Windows"], "ubuntu")
+fileVaultMavenStdBuild([11, 8, 17], 11, [ "ubuntu", "Windows"], "ubuntu", "apache_jackrabbit-filevault")
 ```
 
 The first argument is an array of JDK versions to build with, the second one the main JDK version.
 The third argument is an array of node labels to build on, the fourth one the main node label.
+The fifth argument is the SonarCloud project key.
 
 The main parameters specify on which environment the lengthy (environment independent) steps should happen like SonarQube analysis and optional deployment.
\ No newline at end of file
diff --git a/vars/fileVaultMavenStdBuild.groovy b/vars/fileVaultMavenStdBuild.groovy
index 69e1db7..882df40 100644
--- a/vars/fileVaultMavenStdBuild.groovy
+++ b/vars/fileVaultMavenStdBuild.groovy
@@ -35,7 +35,7 @@ def executeMaven(String jdkLabel, String mavenArguments, String publisherStrateg
     }
 }
 
-def buildStage(final int jdkVersion, final String nodeLabel, final boolean isMainBuild) {
+def buildStage(final int jdkVersion, final String nodeLabel, final boolean isMainBuild, final String sonarProjektKey) {
     return {
         // https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix
         def availableJDKs = [ 8: 'jdk_1.8_latest', 9: 'jdk_1.9_latest', 10: 'jdk_10_latest', 11: 'jdk_11_latest', 12: 'jdk_12_latest', 13: 'jdk_13_latest', 14: 'jdk_14_latest', 15: 'jdk_15_latest', 16: 'jdk_16_latest', 17: 'jdk_17_latest', 18: 'jdk_18_latest']
@@ -70,7 +70,7 @@ def buildStage(final int jdkVersion, final String nodeLabel, final boolean isMai
                 stage("SonarCloud Analysis") {
                     timeout(60) {
                         withCredentials([string(credentialsId: 'sonarcloud-filevault-token', variable: 'SONAR_TOKEN')]) {
-                            String mavenArguments = "${sonarPluginGav}:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_jackrabbit-filevault"
+                            String mavenArguments = "${sonarPluginGav}:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=${sonarProjectKey}"
                             executeMaven(jdkLabel, mavenArguments, 'IMPLICIT')
                         }
                     }
@@ -95,22 +95,22 @@ def buildStage(final int jdkVersion, final String nodeLabel, final boolean isMai
     }
 }
 
-def stagesFor(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel) {
+def stagesFor(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel, String sonarProjectKey) {
     def stageMap = [:]
     for (nodeLabel in nodeLabels) {
         for (jdkVersion in jdkVersions) {
             boolean isMainBuild = (jdkVersion == mainJdkVersion && nodeLabel == mainNodeLabel)
-            stageMap["JDK ${jdkVersion}, ${nodeLabel}${isMainBuild ? ' (Main)' : ''}"] = buildStage(jdkVersion, nodeLabel, isMainBuild)
+            stageMap["JDK ${jdkVersion}, ${nodeLabel}${isMainBuild ? ' (Main)' : ''}"] = buildStage(jdkVersion, nodeLabel, isMainBuild, sonarProjectKey)
         }
     }
     return stageMap
 }
 
 // valid node labels in https://cwiki.apache.org/confluence/display/INFRA/ci-builds.apache.org
-def call(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel) {
+def call(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel, String sonarProjectKey) {
     // adjust some job properties (https://www.jenkins.io/doc/pipeline/steps/workflow-multibranch/#properties-set-job-properties)
     properties([
         buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'))
     ])
-    parallel stagesFor(jdkVersions, mainJdkVersion, nodeLabels, mainNodeLabel)
+    parallel stagesFor(jdkVersions, mainJdkVersion, nodeLabels, mainNodeLabel, sonarProjectKey)
 }
\ No newline at end of file