pipeline.groovy
changeset 84 c3ee903ac366
parent 69 23cdc822cfc5
--- a/pipeline.groovy	Wed Nov 02 22:00:20 2016 +0000
+++ b/pipeline.groovy	Mon Nov 14 20:09:29 2016 +0000
@@ -24,21 +24,36 @@
  * "Default" pipeline:
  */
 def build() {
-    matrix ( configurations ) {
-        stage ( "Checkout - {${env.NODE}-${env.ARCH}} " ) {
-            checkout scm
-            sshagent([ scm.getCredentialsId() ]) {
-                sh  "ruby Jenkinsfile.rb --project \"stx:jv-branch\" --arch ${env.ARCH} --repository-set \"ci-jv\" update"
+    stage ( "Build" ) {
+        matrix ( configurations ) {
+            stage ( "Checkout - {${env.NODE}-${env.ARCH}} " ) {
+                sshagent([ scm.getCredentialsId() ]) {
+                    sh  """
+                        if [ -f Jenkinsfile.rb ]; then
+                            hg pull ${scm.getSource()}
+                        else
+                            hg clone ${scm.getSource()}
+                        fi
+                        hg up ${scm.getBranch()}
+                        """
+                    sh  "ruby Jenkinsfile.rb --project \"stx:jv-branch\" --arch ${env.ARCH} --repository-set \"ci-jv\" update"
+                }
+            }
+
+            stage ( "Compile - {${env.NODE}-${env.ARCH}}") {
+                sh "ruby Jenkinsfile.rb --project \"stx:jv-branch\" compile"
             }
         }
+    }
+}
 
-        stage ( "Compile - {${env.NODE}-${env.ARCH}}") {
-            sh "ruby Jenkinsfile.rb --project \"stx:jv-branch\" compile"
-        }
-
-        stage ( "Test - {${env.NODE}-${env.ARCH}}") {
-            sh "ruby Jenkinsfile.rb --project \"stx:jv-branch\" test"
-            junit allowEmptyResults: true, testResults: "reports/*build${env.BUILD_NUMBER}*.xml"
+def test() {
+    stage ( "Test" ) {
+        matrix ( configurations ) {
+            stage ( "Test - {${env.NODE}-${env.ARCH}}") {
+                sh "ruby Jenkinsfile.rb --project \"stx:jv-branch\" test"
+                junit allowEmptyResults: true, testResults: "reports/*build${env.BUILD_NUMBER}*.xml"
+            }
         }
     }
 }
@@ -79,7 +94,7 @@
 
 def matrix(configurations, block) {
     def combinations = combine(configurations).toArray()
-    def branches = [:]
+    def branches = [failFast: true]
     for (i = 0; i < combinations.length; i++) {
         def index = i
         def conf = combinations[i];