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/06 07:52:59 UTC

[jackrabbit-filevault] branch feature/asf-jenkinsfile updated (83948d5 -> 1747837)

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

kwin pushed a change to branch feature/asf-jenkinsfile
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git.


 discard 83948d5  sonarqube and deployment
     new 1747837  sonarqube and deployment

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (83948d5)
            \
             N -- N -- N   refs/heads/feature/asf-jenkinsfile (1747837)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 parent/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

[jackrabbit-filevault] 01/01: sonarqube and deployment

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 174783786a063abc4ef25f46b47a36b930ea9ef7
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Oct 6 09:07:13 2021 +0200

    sonarqube and deployment
---
 Jenkinsfile    | 81 +++++++++++++++++++++++++++++++++++++++++++---------------
 parent/pom.xml |  2 ++
 2 files changed, 63 insertions(+), 20 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 2565ab1..c1ee1f4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -22,28 +22,69 @@ properties([
     buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10'))
 ])
 
+def isOnMainBranch() {
+    return BRANCH_NAME == 'master'
+}
+
+
 def buildStage(final String jdkLabel, final String nodeLabel, final boolean isMainBuild) {
     return {
-	    stage("Maven Build (${jdkLabel}, ${nodeLabel}") {
-	        node(label: nodeLabel) {
-	            timeout(60) {
-	                checkout scm
-	                // TODO: sonarqube
-	                // always build with Java 11 (that is the minimum version supported: https://sonarcloud.io/documentation/appendices/end-of-support/)
-	                withMaven(maven: 'maven_3_latest', 
-	                          jdk: jdkLabel,
-	                          publisherStrategy: 'IMPLICIT') {
-	                          if (isUnix()) {
-	                                 sh  "mvn -U clean verify"
-	                          } else {
-	                                bat "mvn -U clean verify"
-	                          }
-	                }
-	            }
-	        }
-	    }
-    }
+        stage("${isMainBuild ? 'Main ' : ''}Maven Build (${jdkLabel}, ${nodeLabel})") {
+            node(label: nodeLabel) {
+                timeout(60) {
+                    checkout scm
+                    String mavenArguments
+                    if (isMainBuild) {
+                        mavenArguments = '-U -B clean deploy site sonar:sonar -B -Pjacoco-report -Dsonar.projectKey=apache_jackrabbit-filevault -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir -Dlogback.configurationFile=vault-core/src/test/resources/logback-only-errors.xml'
+                    } else {
+                        mavenArguments = '-U -B clean verify site'
+                    }
 
+                    withCredentials([string(credentialsId: 'sonarcloud-filevault-token', variable: 'SONAR_TOKEN')]) {
+                        withMaven(
+                            maven: 'maven_3_latest', 
+                            jdk: jdkLabel,
+                            mavenLocalRepo: '.repository',
+                            publisherStrategy: 'IMPLICIT') {
+                            if (isUnix()) {
+                                sh  "mvn ${mavenArguments}"
+                            } else {
+                                bat "mvn ${mavenArguments}"
+                            }
+                        }
+                    }
+                    if (isMainBuild && isOnMainBranch()) {
+                        // Stash the build results so we can deploy them on another node
+                        stash name: 'filevault-build-snapshots', includes: 'local-snapshots-dir/**'
+                    }
+                }
+            }
+        }
+        if (isMainBuild && isOnMainBranch()) {
+            stage("Deployment") {
+                node('nexus-deploy') {
+                    timeout(60) {
+                        // Unstash the previously stashed build results.
+                        unstash name: 'filevault-build-snapshots'
+                        
+                        withMaven(
+                            maven: 'maven_3_latest', 
+                            jdk: jdkLabel,
+                            mavenLocalRepo: '.repository',
+                            publisherStrategy: 'IMPLICIT') {
+                            // https://github.com/sonatype/nexus-maven-plugins/tree/master/staging/maven-plugin#deploy-staged-repository
+                            String mavenArguments = 'org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy-staged-repository -DrepositoryDirectory=./local-snapshots-dir -DnexusUrl=https://repository.apache.org/content/repositories/snapshots -DserverId=apache.snapshots.https'
+                            if (isUnix()) {
+                                sh  "mvn ${mavenArguments}"
+                            } else {
+                                bat "mvn ${mavenArguments}"
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 }
 
 def stagesFor(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel) {
@@ -53,7 +94,7 @@ def stagesFor(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLa
     for (nodeLabel in nodeLabels) {
         for (jdkVersion in jdkVersions) {
             boolean isMainBuild = (jdkVersion == mainJdkVersion && nodeLabel == mainNodeLabel)
-            stageMap["JDK ${jdkVersion}, Node label ${nodeLabel}"] = buildStage(availableJDKs[jdkVersion], nodeLabel, isMainBuild)
+            stageMap["JDK ${jdkVersion}, ${nodeLabel}${isMainBuild ? ' (Main)' : ''}"] = buildStage(availableJDKs[jdkVersion], nodeLabel, isMainBuild)
         }
     }
     return stageMap
diff --git a/parent/pom.xml b/parent/pom.xml
index f8c0456..e3fb884 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -257,6 +257,8 @@ Bundle-Category: jackrabbit
                             <exclude>**/*.zip/**</exclude>
                             <exclude>.mvn/**</exclude>
                             <exclude>.no-defender.sh</exclude>
+                            <exclude>.repository/**</exclude>
+                            <exclude>local-snapshots-dir/**</exclude>
                         </excludes>
                     </configuration>
                 </plugin>