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 2022/01/07 07:48:27 UTC

[jackrabbit-filevault-jenkins-lib] branch feature/JCRVLT-580-parameterize-maven-version updated (c98190e -> 34f307c)

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

kwin pushed a change to branch feature/JCRVLT-580-parameterize-maven-version
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-jenkins-lib.git.


 discard c98190e  allow to configure each stage separately
     new 34f307c  allow to configure each stage separately

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   (c98190e)
            \
             N -- N -- N   refs/heads/feature/JCRVLT-580-parameterize-maven-version (34f307c)

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:
 src/org/apache/jackrabbit/vault/PipelineSupport.groovy |  2 +-
 vars/vaultStageBuild.groovy                            |  4 ++--
 vars/vaultStageIT.groovy                               | 12 ++++++++++--
 3 files changed, 13 insertions(+), 5 deletions(-)

[jackrabbit-filevault-jenkins-lib] 01/01: allow to configure each stage separately

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

kwin pushed a commit to branch feature/JCRVLT-580-parameterize-maven-version
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-jenkins-lib.git

commit 34f307caa2d30c1cc929e9be307742d0694e0d88
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Jan 5 17:07:43 2022 +0100

    allow to configure each stage separately
---
 .gitignore                                         |   3 +
 .../vault/AsfCloudbeesJenkinsEnvironment.groovy    |  49 ++++++
 .../apache/jackrabbit/vault/PipelineSupport.groovy |  87 ++++++++++
 vars/fileVaultMavenStdBuild.groovy                 | 188 ---------------------
 vars/vaultPipeline.groovy                          |  38 +++++
 vars/vaultStageBuild.groovy                        |  77 +++++++++
 vars/vaultStageDeploy.groovy                       |  47 ++++++
 vars/vaultStageIT.groovy                           |  53 ++++++
 8 files changed, 354 insertions(+), 188 deletions(-)

diff --git a/.gitignore b/.gitignore
index d8fe4fa..0accafe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 /.project
+/bin/
+/.settings
+/.classpath
\ No newline at end of file
diff --git a/src/org/apache/jackrabbit/vault/AsfCloudbeesJenkinsEnvironment.groovy b/src/org/apache/jackrabbit/vault/AsfCloudbeesJenkinsEnvironment.groovy
new file mode 100644
index 0000000..0ca356b
--- /dev/null
+++ b/src/org/apache/jackrabbit/vault/AsfCloudbeesJenkinsEnvironment.groovy
@@ -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.
+ */
+package org.apache.jackrabbit.vault
+
+class AsfCloudbeesJenkinsEnvironment {
+    
+    // always major.minor.qualifier version parts or just one (which means latest of that major version)
+    public static String getMavenLabel(boolean isWindows, String mavenVersion) {
+        final String versionLabel
+        if (mavenVersion ==~ /\d+/) {
+            versionLabel = "${mavenVersion}_latest"
+        } else if (mavenVersion ==~ /\d+\.\d+\.\d+/) {
+            // make sure it
+            final String suffix
+            if (isWindows) {
+                suffix = "_windows"
+            } else {
+                suffix = ""
+            }
+            versionLabel = "${mavenVersion}${suffix}"
+        } else {
+            throw new IllegalArgumentException('mavenVersion must be either one integer or three integers separated by dot')
+        }
+        // valid installation names in https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix and https://github.com/apache/infrastructure-p6/blob/production/modules/jenkins_client_master/files/hudson.tasks.Maven.xml
+        return "maven_${versionLabel}"
+    }
+
+    public static String getJdkLabel(int jdkVersion) {
+        // 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', 19: 'jdk_19_latest']
+        return availableJDKs[jdkVersion]
+    }
+}
diff --git a/src/org/apache/jackrabbit/vault/PipelineSupport.groovy b/src/org/apache/jackrabbit/vault/PipelineSupport.groovy
new file mode 100644
index 0000000..3c82a39
--- /dev/null
+++ b/src/org/apache/jackrabbit/vault/PipelineSupport.groovy
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+package org.apache.jackrabbit.vault
+
+/**
+ * Singleton class encapsulating information about main build environment and some helper methods.
+ */
+class PipelineSupport implements Serializable {
+    
+    static PipelineSupport INSTANCE;
+    
+    static PipelineSupport createInstance(String mainNodeLabel, int mainJdkVersion, String mainMavenVersion, boolean isOnMainBranch) {
+        INSTANCE = new PipelineSupport(mainNodeLabel, mainJdkVersion, mainMavenVersion, isOnMainBranch)
+        return INSTANCE
+    }
+
+    static PipelineSupport getInstance() {
+        if (INSTANCE == null) {
+            throw new IllegalStateException("createInstance has not been called before, not wrapped in vaultPipeline step?")
+        }
+        return INSTANCE;
+    }
+
+    private final String mainNodeLabel;
+    private final Integer mainJdkVersion;
+    private final String mainMavenVersion;
+    private final boolean isOnMainBranch;
+
+    PipelineSupport(String mainNodeLabel, int mainJdkVersion, String mainMavenVersion, boolean isOnMainBranch) {
+        this.mainNodeLabel = mainNodeLabel
+        this.mainJdkVersion = mainJdkVersion;
+        this.mainMavenVersion = mainMavenVersion
+        this.isOnMainBranch = isOnMainBranch
+    }
+
+    def executeMaven(pipeline, String mavenArguments, boolean enablePublishers) {
+        executeMaven(pipeline, mainJdkVersion, mainMavenVersion, mavenArguments, enablePublishers)
+    }
+
+    static def executeMaven(pipeline, Integer jdkVersion, String mavenVersion, String mavenArguments, boolean enablePublishers) {
+        pipeline.withMaven(
+            maven: AsfCloudbeesJenkinsEnvironment.getMavenLabel(!pipeline.isUnix(), mavenVersion),
+            jdk: AsfCloudbeesJenkinsEnvironment.getJdkLabel(jdkVersion),
+            mavenLocalRepo: '.repository',
+            publisherStrategy: enablePublishers?'IMPLICIT':'EXPLICIT') {
+            if (pipeline.isUnix()) {
+                pipeline.sh "mvn -B ${mavenArguments}"
+            } else {
+                pipeline.bat "mvn -B ${mavenArguments}"
+            }
+        }
+    }
+
+    def stagesForMainAndAdditional(Set<String> nodeLabels, Set<Integer> jdkVersions, Set<String> mavenVersions, Closure closure) {
+        stagesFor(nodeLabels.plus(mainNodeLabel), jdkVersions.plus(mainJdkVersion), mavenVersions.plus(mainMavenVersion), closure)
+    }
+
+    def stagesFor(Set<String> nodeLabels, Set<Integer> jdkVersions, Set<String> mavenVersions, Closure closure) {
+        def stageMap = [:]
+        
+        for (nodeLabel in nodeLabels) {
+            for (jdkVersion in jdkVersions) {
+                for (mavenVersion in mavenVersions) {
+                    boolean isMainBuild = (nodeLabel.equals(mainNodeLabel) && jdkVersion.equals(mainJdkVersion) && mavenVersion.equals(mainMavenVersion))
+                    stageMap["JDK ${jdkVersion}, ${nodeLabel}, Maven ${mavenVersion}${isMainBuild ? ' (Main)' : ''}"] = closure(nodeLabel, jdkVersion, mavenVersion, isMainBuild)
+                }
+            }
+        }
+        return stageMap
+    }
+}
diff --git a/vars/fileVaultMavenStdBuild.groovy b/vars/fileVaultMavenStdBuild.groovy
deleted file mode 100644
index 55c2afc..0000000
--- a/vars/fileVaultMavenStdBuild.groovy
+++ /dev/null
@@ -1,188 +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.
- */
-
-def isOnMainBranch() {
-    return env.BRANCH_NAME == 'master'
-}
-
-def executeMaven(String jdkLabel, String mavenArguments, String publisherStrategy) {
-    executeMaven(jdkLabel, getMavenLabel('3'), mavenArguments, publisherStrategy)
-}
-
-def executeMaven(String jdkLabel, String mavenLabel, String mavenArguments, String publisherStrategy) {
-    withMaven(
-        maven: mavenLabel,
-        jdk: jdkLabel,
-        mavenLocalRepo: '.repository',
-        publisherStrategy: publisherStrategy) {
-        if (isUnix()) {
-            sh "mvn -B ${mavenArguments}"
-        } else {
-            bat "mvn -B ${mavenArguments}"
-        }
-    }
-}
-
-// always major.minor.qualifier version parts or just one (which means latest of that major version)
-String getMavenLabel(String mavenVersion) {
-    final String versionLabel
-    if (mavenVersion ==~ /\d+/) {
-        versionLabel = "${mavenVersion}_latest"
-    } else if (mavenVersion ==~ /\d+\.\d+\.\d+/) {
-        // make sure it
-        final String suffix
-        if (isUnix()) {
-            suffix = ""
-        } else {
-            suffix = "_windows"
-        }
-        versionLabel = "${mavenVersion}${suffix}"
-    } else {
-        error('mavenVersion must be either one integer or three integers separated by dot')
-    }
-    // valid installation names in https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix and https://github.com/apache/infrastructure-p6/blob/production/modules/jenkins_client_master/files/hudson.tasks.Maven.xml
-    return "maven_${versionLabel}"
-}
-
-def buildStage(final String jdkLabel, final String nodeLabel, final String mavenVersion, final boolean isMainBuild, final String sonarProjectKey) {
-    return {
-        final String wagonPluginGav = "org.codehaus.mojo:wagon-maven-plugin:2.0.2"
-        final String sonarPluginGav = "org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184"
-        node(label: nodeLabel) {
-            stage("${isMainBuild ? 'Main ' : ''}Maven Build (JDK ${jdkLabel}, Maven ${mavenVersion}, ${nodeLabel})") {
-                timeout(60) {
-                    final String mavenLabel = getMavenLabel(mavenVersion) // this requires a node context
-                    echo "Running on node ${env.NODE_NAME}"
-                    checkout scm
-                    try {
-                        String mavenArguments
-                        if (isMainBuild) {
-                            String localRepoPath = "${env.WORKSPACE}/local-snapshots-dir"
-                            // Make sure the directory is wiped.
-                            dir(localRepoPath) {
-                                deleteDir()
-                            }
-                            mavenArguments = "-U clean site deploy -DskipITs -DaltDeploymentRepository=snapshot-repo::default::file:${localRepoPath} -Pjacoco-report -Dlogback.configurationFile=vault-core/src/test/resources/logback-only-errors.xml"
-                        } else {
-                            mavenArguments = '-U clean package site'
-                        }
-                        executeMaven(jdkLabel, mavenLabel, mavenArguments, 'IMPLICIT')
-                        if (isMainBuild) {
-                            // stash the integration test classes for later execution
-                            stash name: 'integration-test-classes', includes: '**/target/test-classes/**'
-                            if (isOnMainBranch()) {
-                                // Stash the build results so we can deploy them on another node
-                                stash name: 'local-snapshots-dir', includes: 'local-snapshots-dir/**'
-                            }
-                        }
-                    } finally {
-                        junit '**/target/surefire-reports/**/*.xml'
-                    }
-                }
-            }
-            /*
-            if (isMainBuild) {
-                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=${sonarProjectKey}"
-                            executeMaven(jdkLabel, mavenArguments, 'EXPLICIT')
-                        }
-                    }
-                }
-            }*/
-        }
-        if (isMainBuild && isOnMainBranch()) {
-            stage("Deployment") {
-                node('nexus-deploy') {
-                    timeout(60) {
-                        // Nexus deployment needs pom.xml
-                        checkout scm
-                        // Unstash the previously stashed build results.
-                        unstash name: 'local-snapshots-dir'
-                        // https://www.mojohaus.org/wagon-maven-plugin/merge-maven-repos-mojo.html
-                        String mavenArguments = "${wagonPluginGav}:merge-maven-repos -Dwagon.target=https://repository.apache.org/content/repositories/snapshots -Dwagon.targetId=apache.snapshots.https -Dwagon.source=file:${env.WORKSPACE}/local-snapshots-dir"
-                        executeMaven(jdkLabel, mavenArguments, 'EXPLICIT')
-                    }
-                }
-            }
-        }
-    }
-}
-
-def stageIT(final String jdkLabel, final String nodeLabel, final String mavenVersion) {
-    stage("Run Integration Tests") {
-        node(nodeLabel) {
-            timeout(60) {
-                // running ITs needs pom.xml
-                checkout scm
-                // Unstash the previously stashed build results.
-                unstash name: 'integration-test-classes'
-                try {
-                    final String mavenLabel = getMavenLabel(mavenVersion) // this requires a node context
-                    // populate test source directory
-                    String mavenArguments = '-X failsafe:integration-test failsafe:verify'
-                    executeMaven(jdkLabel, mavenLabel, mavenArguments, 'EXPLICIT')
-                } finally {
-                    junit '**/target/failsafe-reports*/**/*.xml'
-                }
-            }
-        }
-    }
-}
-
-def stagesFor(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel, List<String> mavenVersions, String mainMavenVersion, String sonarProjectKey) {
-    def stageMap = [:]
-    // 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', 19: 'jdk_19_latest']
-    
-    for (nodeLabel in nodeLabels) {
-        for (jdkVersion in jdkVersions) {
-            final String jdkLabel = availableJDKs[jdkVersion]
-            for (mavenVersion in mavenVersions) {
-                boolean isMainBuild = (jdkVersion == mainJdkVersion && nodeLabel == mainNodeLabel && mainMavenVersion == mavenVersion)
-                stageMap["JDK ${jdkVersion}, ${nodeLabel}, Maven ${mavenVersion} ${isMainBuild ? ' (Main)' : ''}"] = buildStage(jdkLabel, nodeLabel, mavenVersion, 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, String sonarProjectKey) {
-    call(jdkVersions, mainJdkVersion, nodeLabels, mainNodeLabel, ["3"], "3", sonarProjectKey)
-}
-
-def call(List<Integer> jdkVersions, int mainJdkVersion, List<String> nodeLabels, String mainNodeLabel, List<String> mavenVersions, String mainMavenVersion, String sonarProjectKey) {
-    // adjust some job properties (https://www.jenkins.io/doc/pipeline/steps/workflow-multibranch/#properties-set-job-properties)
-    def buildProperties = []
-    if (isOnMainBranch()) {
-      // set build retention time first
-      buildProperties.add(buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '15', numToKeepStr: '10')))
-      // ensure a build is done every month
-      buildProperties.add(pipelineTriggers([cron('@monthly')]))
-    } else {
-      buildProperties.add(buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '7', numToKeepStr: '3')))
-    }
-    properties(buildProperties)
-    parallel stagesFor(jdkVersions, mainJdkVersion, nodeLabels, mainNodeLabel, mavenVersions, mainMavenVersion, sonarProjectKey)
-    // TODO: trigger ITs separately
-    stageIT('jdk_1.8_latest', mainNodeLabel, '3.3.9')
-    // finally do deploy
-}
diff --git a/vars/vaultPipeline.groovy b/vars/vaultPipeline.groovy
new file mode 100644
index 0000000..ed71f43
--- /dev/null
+++ b/vars/vaultPipeline.groovy
@@ -0,0 +1,38 @@
+/**
+ * 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.
+ */
+
+import org.apache.jackrabbit.vault.PipelineSupport
+
+// valid node labels in https://cwiki.apache.org/confluence/display/INFRA/ci-builds.apache.org
+def call(String mainNodeLabel, int mainJdkVersion, String mainMavenVersion, Closure body) {
+    PipelineSupport pipelineSupport = PipelineSupport.createInstance(mainNodeLabel, mainJdkVersion, mainMavenVersion, env.BRANCH_NAME == 'master')
+    // adjust some job properties (https://www.jenkins.io/doc/pipeline/steps/workflow-multibranch/#properties-set-job-properties)
+    def buildProperties = []
+    if (pipelineSupport.isOnMainBranch) {
+      // set build retention time first
+      buildProperties.add(buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '5', daysToKeepStr: '15', numToKeepStr: '10')))
+      // ensure a build is done every month
+      buildProperties.add(pipelineTriggers([cron('@monthly')]))
+    } else {
+      buildProperties.add(buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '7', numToKeepStr: '3')))
+    }
+    properties(buildProperties)
+    body()
+}
+
diff --git a/vars/vaultStageBuild.groovy b/vars/vaultStageBuild.groovy
new file mode 100644
index 0000000..7783fc7
--- /dev/null
+++ b/vars/vaultStageBuild.groovy
@@ -0,0 +1,77 @@
+/**
+ * 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.
+ */
+
+import org.apache.jackrabbit.vault.PipelineSupport
+
+// valid node labels in https://cwiki.apache.org/confluence/display/INFRA/ci-builds.apache.org
+def call(List<String> additionalNodeLabels, List<Integer> additionalJdkVersions, List<String> additionalMavenVersions, String sonarProjectKey) {
+    PipelineSupport pipelineSupport = PipelineSupport.getInstance()
+    parallel pipelineSupport.stagesForMainAndAdditional(additionalNodeLabels.toSet(), additionalJdkVersions.toSet(), additionalMavenVersions.toSet(), 
+        { String nodeLabel, Integer jdkVersion, String mavenVersion, boolean isMainBuild -> 
+            return {
+                final String sonarPluginGav = "org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184"
+                node(label: nodeLabel) {
+                    stage("${isMainBuild ? 'Main ' : ''}Maven Build (JDK ${jdkVersion}, Maven ${mavenVersion}, ${nodeLabel})") {
+                        timeout(60) {
+                            echo "Running on node ${env.NODE_NAME}"
+                            checkout scm
+                            try {
+                                String mavenArguments
+                                if (isMainBuild) {
+                                    String localRepoPath = "${env.WORKSPACE}/local-snapshots-dir"
+                                    // Make sure the directory is wiped.
+                                    dir(localRepoPath) {
+                                        deleteDir()
+                                    }
+                                    // main build with IT for properly calculating coverage
+                                    mavenArguments = "-U clean site deploy -DaltDeploymentRepository=snapshot-repo::default::file:${localRepoPath} -Pjacoco-report -Dlogback.configurationFile=vault-core/src/test/resources/logback-only-errors.xml"
+                                } else {
+                                    mavenArguments = '-U clean package site' // without executing ITs
+                                }
+                                PipelineSupport.executeMaven(this, jdkVersion, mavenVersion, mavenArguments, true)
+                                if (isMainBuild) {
+                                    // stash the integration test classes and the build artifact for later execution
+                                    stash name: 'integration-test-classes', includes: '**/target/test-classes/**,**/target/*.jar'
+                                    if (pipelineSupport.isOnMainBranch) {
+                                        // Stash the build results so we can deploy them on another node
+                                        stash name: 'local-snapshots-dir', includes: 'local-snapshots-dir/**'
+                                    }
+                                }
+                            } catch (Throwable e) {
+                                 error 'Error during building ' + e.toString()
+                            }  finally {
+                                junit '**/target/surefire-reports/**/*.xml'
+                            }
+                        }
+                    }
+                    /*
+                    if (isMainBuild) {
+                        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=${sonarProjectKey}"
+                                    executeMaven(jdkLabel, mavenArguments, 'EXPLICIT')
+                                }
+                            }
+                        }
+                    }*/
+                }
+            }
+        } )
+}
diff --git a/vars/vaultStageDeploy.groovy b/vars/vaultStageDeploy.groovy
new file mode 100644
index 0000000..92932ba
--- /dev/null
+++ b/vars/vaultStageDeploy.groovy
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+import org.apache.jackrabbit.vault.PipelineSupport
+
+
+def deployStage(final PipelineSupport pipelineSupport) {
+    return {
+        if (isMainBuild && pipelineSupport.isOnMainBranch) {
+            final String wagonPluginGav = "org.codehaus.mojo:wagon-maven-plugin:2.0.2"
+            stage("Deployment") {
+                node('nexus-deploy') {
+                    timeout(60) {
+                        // Nexus deployment needs pom.xml
+                        checkout scm
+                        // Unstash the previously stashed build results.
+                        unstash name: 'local-snapshots-dir'
+                        // https://www.mojohaus.org/wagon-maven-plugin/merge-maven-repos-mojo.html
+                        String mavenArguments = "${wagonPluginGav}:merge-maven-repos -Dwagon.target=https://repository.apache.org/content/repositories/snapshots -Dwagon.targetId=apache.snapshots.https -Dwagon.source=file:${env.WORKSPACE}/local-snapshots-dir"
+                        pipelineSupport.executeMaven(this, mavenArguments, false)
+                    }
+                }
+            }
+        }
+    }
+}
+
+def call() {
+    PipelineSupport pipelineSupport = PipelineSupport.getInstance()
+    deployStage(pipelineSupport).call()
+}
\ No newline at end of file
diff --git a/vars/vaultStageIT.groovy b/vars/vaultStageIT.groovy
new file mode 100644
index 0000000..d8fb118
--- /dev/null
+++ b/vars/vaultStageIT.groovy
@@ -0,0 +1,53 @@
+/**
+ * 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.
+ */
+
+import org.apache.jackrabbit.vault.PipelineSupport
+import java.io.File
+import groovy.io.FileType
+
+// valid node labels in https://cwiki.apache.org/confluence/display/INFRA/ci-builds.apache.org
+def call(List<String> additionalNodeLabels, List<Integer> additionalJdkVersions, List<String> additionalMavenVersions) {
+    PipelineSupport pipelineSupport = PipelineSupport.getInstance()
+    parallel pipelineSupport.stagesFor(additionalNodeLabels.toSet(), additionalJdkVersions.toSet(), additionalMavenVersions.toSet(), 
+        {String nodeLabel, int jdkVersion, String mavenVersion, boolean isMainBuild -> 
+            stage("Run Integration Tests") {
+                node(nodeLabel) {
+                    timeout(60) {
+                        // running ITs needs pom.xml
+                        checkout scm
+                        // Unstash the previously stashed build results.
+                        unstash name: 'integration-test-classes'
+                        try {
+                            // install to be tested artifact to local repository
+                            File jarFile
+                            File targetDirectory = new File("target")
+                            targetDirectory.eachFileMatch(FileType.FILES, ~/.*\.jar/, { jarFile = new File(targetDirectory, it.name) })
+                            String mavenArguments = "install:install-file -Dfile=${jarFile} -DpomFile=pom.xml"
+                            pipelineSupport.executeMaven(this, jdkVersion, mavenVersion, mavenArguments, false)
+                            // execute ITs
+                            mavenArguments = 'failsafe:integration-test failsafe:verify'
+                            pipelineSupport.executeMaven(this, jdkVersion, mavenVersion, mavenArguments, false)
+                        } finally {
+                            junit '**/target/failsafe-reports*/**/*.xml'
+                        }
+                    }
+                }
+            }
+        } )
+}