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

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

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

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:
 .travis.yml | 86 -------------------------------------------------------------
 Jenkinsfile |  2 +-
 2 files changed, 1 insertion(+), 87 deletions(-)
 delete mode 100644 .travis.yml

[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 cb300d401de87a149667eebfef1d5c2a8cd613ee
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Oct 6 09:07:13 2021 +0200

    sonarqube and deployment
---
 .travis.yml    | 86 ----------------------------------------------------------
 Jenkinsfile    | 81 ++++++++++++++++++++++++++++++++++++++++--------------
 parent/pom.xml |  2 ++
 3 files changed, 63 insertions(+), 106 deletions(-)

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 11a737b..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-# 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.
-
-# use https://github.com/DanySK/Gravis-CI for Maven Builds on Windows
-
-# Java is not yet supported on Windows, so the build would block.
-# You do not need any setup from Travis, use a plain bash build
-language: bash
-# Enable them all, if you need them.
-os:
-  - linux
-#  - osx
-  - windows
-git:
-  symlinks: true
-env:
-  global:
-    # This is a convenience variable for shortening download commands
-    - GRAVIS="https://raw.githubusercontent.com/DanySK/Gravis-CI/master/"
-    - MAVEN_VERSION="3.6.3"
-    # If you use Windows, you may want to disable Windows Defender. It slows down the builds
-    # dramatically, also during cache setup. From a Tanzinul Islam's idea: http://bit.ly/348VPYS,
-    # This work around disables it before caching
-    - NO_WIN_DEFENDER=$(curl "${GRAVIS}.disable-windows-defender.sh" --output .no-defender.sh && source .no-defender.sh)
-  matrix:
-    # List any JDK you want to build your software with.
-    # You can see the list of supported environments by installing Jabba and using ls-remote:
-    # https://github.com/shyiko/jabba#usage
-    # Partial versions are allowed. They are dynamically resoved by launching jabba ls-remote,
-    # filtering for the provided JDK string, then picking the *first* match. This is useful if
-    # the intent is to target the latest release of some Java major release, or if the latest
-    # available build differs among platforms.
-    - JDK="adopt@1.8"
-    - JDK="adopt@1.11"
-    - JDK="adopt@1.16"
-jobs:
-  include:
-  - os: linux
-    env:
-       - JDK="adopt@1.11"
-       - LANG="de_DE.UTF-8"
-       - LC_ALL="de_DE.UTF-8"
-       - SONARQUBE_EXECUTION=true
-before_install:
-  # Download the script
-  - curl "${GRAVIS}.install-jdk-travis.sh" --output ~/.install-jdk-travis.sh
-  # Download, install, configue the JDK, and export the configuration to the current shell
-  - source ~/.install-jdk-travis.sh
-  - curl "${GRAVIS}.install-maven.sh" --output ~/.install-maven.sh
-  # Download, install, configue the JDK, and export the configuration to the current shell
-  - source ~/.install-maven.sh
-addons:
-  sonarcloud:
-    organization: "apache"
-    token:
-      secure: "EMpJMtN+fqjuyy69BByyUc08QGzgYCA8s40HDLofCExA/7i0o8tDMwLm2nVBUO5RNrvK8YDxdNI4P6zRAytws/KIw8WPJG4ycN3OFhaqccZit0zWzHO+JAD3r7rSc7dRTmC3KzeMjEHJbsbKQywLVUuaSy6vf8x5GJT2KG73hIU=" # encrypted value of your token
-# This is your main script
-script:
-  - | 
-    if [ "$SONARQUBE_EXECUTION" == "true" ]; then 
-      mvn clean verify site sonar:sonar -B -Pjacoco-report -Dsonar.projectKey=apache_jackrabbit-filevault -Dlogback.configurationFile=vault-core/src/test/resources/logback-only-errors.xml
-    else
-      mvn clean verify site -B
-    fi
-# If you use Gradle, cleanup the build cache from lock/temporary files
-before_cache:
-  #- curl "${GRAVIS}.clean_gradle_cache.sh" --output ~/.clean_gradle_cache.sh
-  #- bash ~/.clean_gradle_cache.sh
-cache:
-  directories:
-    # This avoids re-downloading the JDK every time, but Travis recommends not to do it
-    # - $HOME/.jabba/
-    # Cache Maven repo
-    - $HOME/.m2
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
index 2565ab1..b6b5ad3 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.host.url=https://sonarcloud.io -Dsonar.organization=apache -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>