From 7ecb04db2b25c36d270988b2a3b033df54e797fe Mon Sep 17 00:00:00 2001
From: Daniel Agar <daniel@agar.ca>
Date: Sun, 3 Feb 2019 23:26:05 -0500
Subject: [PATCH] Jenkins split MacOS builds into new pipeline

---
 .ci/Jenkinsfile-compile     | 49 ---------------------------
 .ci/Jenkinsfile-compile_mac | 67 +++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 49 deletions(-)
 create mode 100644 .ci/Jenkinsfile-compile_mac

diff --git a/.ci/Jenkinsfile-compile b/.ci/Jenkinsfile-compile
index 66e4935f97..55c5daa263 100644
--- a/.ci/Jenkinsfile-compile
+++ b/.ci/Jenkinsfile-compile
@@ -17,55 +17,6 @@ pipeline {
             snapdragon: "lorenzmeier/px4-dev-snapdragon:2018-09-12"
           ]
 
-          // MAC OSX px4_sitl_default
-          build_nodes["px4_sitl_default (OSX)"] = {
-            node("mac") {
-              withEnv(["CCACHE_BASEDIR=${pwd()}"]) {
-                stage("sitl (OSX)") {
-                  try {
-                    checkout(scm)
-                    sh('export')
-                    sh('make distclean')
-                    sh('ccache -z')
-                    sh('make px4_sitl_default')
-                    sh('ccache -s')
-                    sh('make tests')
-                  }
-                  catch (exc) {
-                    throw (exc)
-                  }
-                  finally {
-                    sh('make distclean')
-                  }
-                }
-              }
-            }
-          }
-
-          // MAC OSX px4_fmu-v4pro_default
-          build_nodes["px4_fmu-v4pro_default (OSX)"] = {
-            node("mac") {
-              withEnv(["CCACHE_BASEDIR=${pwd()}"]) {
-                stage("px4_fmu-v4pro (OSX)") {
-                  try {
-                    checkout(scm)
-                    sh('export')
-                    sh('make distclean')
-                    sh('ccache -z')
-                    sh('make px4_fmu-v4pro_default')
-                    sh('ccache -s')
-                  }
-                  catch (exc) {
-                    throw (exc)
-                  }
-                  finally {
-                    sh('make distclean')
-                  }
-                }
-              }
-            }
-          }
-
           def armhf_builds = [
             target: ["aerotenna_ocpoc_ubuntu"],
             image: docker_images.armhf,
diff --git a/.ci/Jenkinsfile-compile_mac b/.ci/Jenkinsfile-compile_mac
new file mode 100644
index 0000000000..eb3260f018
--- /dev/null
+++ b/.ci/Jenkinsfile-compile_mac
@@ -0,0 +1,67 @@
+#!/usr/bin/env groovy
+
+pipeline {
+  agent none
+  stages {
+
+    stage('Build') {
+
+      parallel {
+
+        stage('px4_sitl_default (OSX)') {
+          agent {
+            label 'mac'
+          }
+          environment {
+            CCACHE_BASEDIR = "${env.WORKSPACE}"
+          }
+          steps {
+            sh 'export'
+            sh 'make distclean'
+            sh 'ccache -z'
+            sh 'make px4_sitl_default'
+            sh 'ccache -s'
+            sh 'make tests'
+          }
+          post {
+            always {
+              sh 'make distclean'
+            }
+          }
+        } // stage px4_sitl_default
+
+        stage('px4_fmu-v5_default (OSX)') {
+          agent {
+            label 'mac'
+          }
+          environment {
+            CCACHE_BASEDIR = "${env.WORKSPACE}"
+          }
+          steps {
+            sh 'export'
+            sh 'make distclean'
+            sh 'ccache -z'
+            sh 'make px4_fmu-v5_default'
+            sh 'ccache -s'
+          }
+          post {
+            always {
+              sh 'make distclean'
+            }
+          }
+        } // stage px4_fmu-v5_default
+
+      } // parallel
+    } // stage Build
+
+  } // stages
+  environment {
+    CCACHE_CPP2 = '1'
+    CCACHE_DIR = '/tmp/ccache'
+    CI = true
+  }
+  options {
+    buildDiscarder(logRotator(numToKeepStr: '5', artifactDaysToKeepStr: '14'))
+    timeout(time: 60, unit: 'MINUTES')
+  }
+}
-- 
GitLab