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:24:24 UTC

[jackrabbit-filevault] branch feature/asf-jenkinsfile updated (41594bb -> cccc0d4)

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 41594bb  sonarqube and deployment
     new cccc0d4  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   (41594bb)
            \
             N -- N -- N   refs/heads/feature/asf-jenkinsfile (cccc0d4)

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:
 Jenkinsfile | 9 +++++----
 1 file changed, 5 insertions(+), 4 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 cccc0d4e4089ecce76295ab3037fc33eaecd186a
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Oct 6 09:07:13 2021 +0200

    sonarqube and deployment
---
 Jenkinsfile | 81 ++++++++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 61 insertions(+), 20 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 2565ab1..3bb7fdf 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) {
+                        // 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=/some/path -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}"] = buildStage(availableJDKs[jdkVersion], nodeLabel, isMainBuild)
         }
     }
     return stageMap