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/07/05 06:41:21 UTC

[jackrabbit-filevault-jenkins-lib] 01/01: add sanity check step

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

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

commit 915605f6c1c6d20b720133717c93620a62db0aba
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Jul 5 08:41:15 2022 +0200

    add sanity check step
    
    enable fail-fast option for parallel builds
---
 .../apache/jackrabbit/vault/PipelineSupport.groovy | 10 ++++--
 vars/vaultSanityCheck.groovy                       | 37 ++++++++++++++++++++++
 vars/vaultStageBuild.groovy                        |  3 +-
 3 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/src/org/apache/jackrabbit/vault/PipelineSupport.groovy b/src/org/apache/jackrabbit/vault/PipelineSupport.groovy
index cd31353..d0c9cb6 100644
--- a/src/org/apache/jackrabbit/vault/PipelineSupport.groovy
+++ b/src/org/apache/jackrabbit/vault/PipelineSupport.groovy
@@ -34,7 +34,7 @@ class PipelineSupport implements Serializable {
         if (INSTANCE == null) {
             throw new IllegalStateException("createInstance has not been called before, not wrapped in vaultPipeline step?")
         }
-        return INSTANCE;
+        return INSTANCE
     }
 
     private final String mainNodeLabel;
@@ -44,7 +44,7 @@ class PipelineSupport implements Serializable {
 
     PipelineSupport(String mainNodeLabel, int mainJdkVersion, String mainMavenVersion, boolean isOnMainBranch) {
         this.mainNodeLabel = mainNodeLabel
-        this.mainJdkVersion = mainJdkVersion;
+        this.mainJdkVersion = mainJdkVersion
         this.mainMavenVersion = mainMavenVersion
         this.isOnMainBranch = isOnMainBranch
     }
@@ -79,7 +79,7 @@ class PipelineSupport implements Serializable {
                 for (mavenVersion in mavenVersions) {
                     boolean isMainBuild = (nodeLabel.equals(mainNodeLabel) && jdkVersion.equals(mainJdkVersion) && mavenVersion.equals(mainMavenVersion))
                     if (excludeMain && isMainBuild) {
-                        continue; // skip main environment
+                        continue // skip main environment
                     }
                     stepsMap["${stepsLabel} (JDK ${jdkVersion}, ${nodeLabel}, Maven ${mavenVersion}${isMainBuild ? ' (Main)' : ''})"] = closure(nodeLabel, jdkVersion, mavenVersion, isMainBuild)
                 }
@@ -87,4 +87,8 @@ class PipelineSupport implements Serializable {
         }
         return stepsMap
     }
+
+    String getMainNodeLabel() {
+        return mainNodeLabel
+    }
 }
\ No newline at end of file
diff --git a/vars/vaultSanityCheck.groovy b/vars/vaultSanityCheck.groovy
new file mode 100644
index 0000000..6e298da
--- /dev/null
+++ b/vars/vaultSanityCheck.groovy
@@ -0,0 +1,37 @@
+/**
+ * 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
+
+/**
+ * Quick sanity check before triggering expensive parallel builds with vaultStageBuild
+ */
+def call() {
+    PipelineSupport pipelineSupport = PipelineSupport.getInstance()
+    stage("Sanity Check") {
+        node(pipelineSupport.getMainNodeLabel()) {
+            timeout(30) {
+                deleteDir()
+                checkout scm
+                String mavenArguments = "clean compile"
+                pipelineSupport.executeMaven(this, mavenArguments, false))
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/vars/vaultStageBuild.groovy b/vars/vaultStageBuild.groovy
index a0f5667..58f3044 100644
--- a/vars/vaultStageBuild.groovy
+++ b/vars/vaultStageBuild.groovy
@@ -77,5 +77,6 @@ def call(List<String> additionalNodeLabels, List<Integer> additionalJdkVersions,
                     }
                 }
             }
-        } )
+        },
+        failFast: true )
 }