You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2022/01/16 16:56:55 UTC

[couchdb] 01/01: Try dynamicMatrix community plugin

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

kocolosk pushed a commit to branch jenkins-dynamic-matrix
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 593f2aa309444ccce9275325fd37adea162411a4
Author: Adam Kocoloski <ko...@apache.org>
AuthorDate: Sun Jan 16 11:56:40 2022 -0500

    Try dynamicMatrix community plugin
---
 build-aux/Jenkinsfile.full | 291 +++++++++++++++++++--------------------------
 1 file changed, 122 insertions(+), 169 deletions(-)

diff --git a/build-aux/Jenkinsfile.full b/build-aux/Jenkinsfile.full
index f1eb35e..41a53b1 100644
--- a/build-aux/Jenkinsfile.full
+++ b/build-aux/Jenkinsfile.full
@@ -13,6 +13,9 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// Source for the dynamicMatrix functionality
+@Library('camunda-community') _
+
 unpack = '''
 pwd
 ls -l
@@ -59,6 +62,16 @@ platform_images = [
   'bullseye': "apache/couchdbci-debian:bullseye-erlang-${ERLANG_VERSION}"
 ]
 
+spidermonkey = [
+  'centos7': '1.8.5',
+  'centos8': '60',
+  'bionic': '1.8.5',
+  'focal': '68',
+  'stretch': '1.8.5',
+  'buster': '60',
+  'bullseye': '78'
+]
+
 gnu_make = ['freebsd': 'gmake', 'macos': 'make']
 
 pipeline {
@@ -127,163 +140,45 @@ pipeline {
       }
     } // stage Build Release Tarball
 
-    // TODO Rework once Improved Docker Pipeline Engine is released
-    // https://issues.jenkins-ci.org/browse/JENKINS-47962
-    // https://issues.jenkins-ci.org/browse/JENKINS-48050
-
     stage('Test and Package') {
-      matrix {
-        axes {
-          axis {
-            name 'platform'
-            values 'freebsd', 'macos', 'centos7', 'centos8', 'bionic', 'focal', 'stretch', 'buster', 'bullseye'
-          }
-          axis {
-            name 'spidermonkey'
-            values '1.8.5', '60', '68', '78'
-          } 
-        }
-        excludes {
-          exclude {
-            axis {
-              name 'platform'
-              values 'centos7', 'bionic', 'stretch', 'freebsd'
-            }
-            axis {
-              name 'spidermonkey'
-              notValues '1.8.5'
-            }
-          }
-          exclude {
-            axis {
-              name 'platform'
-              values 'centos8', 'buster', 'macos'
-            }
-            axis {
-              name 'spidermonkey'
-              notValues '60'
-            }
-          }
-          exclude {
-            axis {
-              name 'platform'
-              values 'focal'
-            }
-            axis {
-              name 'spidermonkey'
-              notValues '68'
-            }
-          }
-          exclude {
-            axis {
-              name 'platform'
-              values 'bullseye'
-            }
-            axis {
-              name 'spidermonkey'
-              notValues '78'
-            }
-          }
-        }
-
-        stages {
-          stage('Other Build') {
-            when {
-              beforeAgent true
-              anyOf {
-                environment name: 'platform', value: 'macos'
-                environment name: 'platform', value: 'freebsd'
-              }
-            }
-
-            agent {
-              label env.platform
-            }
-
-            options {
-              skipDefaultCheckout()
-              timeout(time: 90, unit: "MINUTES")
-            }
-
-            steps {
-              // deleteDir is OK here because we're not inside of a Docker container!
-              deleteDir()
-              unstash 'tarball'
-              withEnv(['HOME='+pwd(), 'PATH+USRLOCAL=/usr/local/bin', 'MAKE='+gnu_make[env.platform]]) {
-                sh( script: unpack, label: 'Unpack tarball' )
-                dir( "${platform}/build/couchdb" ) {
-                  sh 'pwd'
-                  sh 'ls -l'
-                  sh "./configure --skip-deps --spidermonkey-version ${spidermonkey}"
-                  sh '$MAKE'
-                  sh '$MAKE eunit'
-                  sh '$MAKE elixir-suite'
-                  sh '$MAKE exunit'
-                  sh '$MAKE mango-test'
-                }
-              }
-            }
-
-            post {
-              always {
-                junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
-              }
-              failure {
-                dir( "${platform}/build/couchdb" ) {
-                  sh 'make build-report'
+      steps {
+        dynamicMatrixMultiGroups([
+          // Group 1: non-containerized builds (MacOS, FreeBSD)
+          [
+            failFast: false,
+            axes: [
+              platform: 'macos', 'freebsd'
+            ],
+            actions: {
+              stage("${platform}") {
+                agent {
+                  label env.platform
                 }
-              }
-              cleanup {
-                sh 'killall -9 beam.smp || true'
-                sh 'rm -rf ${WORKSPACE}/* ${COUCHDB_IO_LOG_DIR} || true'
-              }
-            } // post
 
-          } // non-containerized platform
-
-          stage('Container Build') {
-            when {
-              beforeAgent true
-              not {
-                anyOf {
-                  environment name: 'platform', value: 'macos'
-                  environment name: 'platform', value: 'freebsd'
+                options {
+                  skipDefaultCheckout()
+                  timeout(time: 90, unit: "MINUTES")
                 }
-              }
-            }
 
-            agent {
-              docker {
-                image platform_images["${platform}"]
-                label 'docker'
-                args "${DOCKER_ARGS}"
-                registryUrl 'https://docker.io/'
-                registryCredentialsId 'dockerhub_creds'
-              }
-            }
-
-            options {
-              skipDefaultCheckout()
-              timeout(time: 90, unit: "MINUTES")
-            }
-
-            stages {
-              stage('Build from tarball & test') {
                 steps {
-                  sh( script: 'rm -rf apache-couchdb-*', label: 'Clean workspace' )
+                  // deleteDir is OK here because we're not inside of a Docker container!
+                  deleteDir()
                   unstash 'tarball'
-                  sh( script: unpack, label: 'Unpack tarball' )
-                  dir( "${platform}/build/couchdb" ) {
-                    sh 'pwd'
-                    sh 'ls -l'
-                    sh "./configure --skip-deps --spidermonkey-version ${spidermonkey}"
-                    sh 'make'
-                    sh 'make eunit'
-                    sh 'make elixir-suite'
-                    sh 'make exunit'
-                    sh 'make mango-test'
+                  withEnv(['HOME='+pwd(), 'PATH+USRLOCAL=/usr/local/bin', 'MAKE='+gnu_make[env.platform]]) {
+                    sh( script: unpack, label: 'Unpack tarball' )
+                    dir( "${platform}/build/couchdb" ) {
+                      sh 'pwd'
+                      sh 'ls -l'
+                      sh "./configure --skip-deps --spidermonkey-version ${spidermonkey[env.platform]}"
+                      sh '$MAKE'
+                      sh '$MAKE eunit'
+                      sh '$MAKE elixir-suite'
+                      sh '$MAKE exunit'
+                      sh '$MAKE mango-test'
+                    }
                   }
                 }
+
                 post {
                   always {
                     junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
@@ -293,33 +188,91 @@ pipeline {
                       sh 'make build-report'
                     }
                   }
-                }
-              }
-
-              stage('Build CouchDB packages') {
-                steps {
-                  unstash 'tarball'
-                  sh( script: make_packages, label: 'Build packages' )
-                  sh( script: cleanup_and_save, label: 'Stage package artifacts for archival' )
-                }
-                post {
-                  success {
-                    archiveArtifacts artifacts: 'pkgs/**', fingerprint: true
+                  cleanup {
+                    sh 'killall -9 beam.smp || true'
+                    sh 'rm -rf ${WORKSPACE}/* ${COUCHDB_IO_LOG_DIR} || true'
                   }
-                }
+                } // post
               }
             }
+          ],
+
+          // Group 2: containerized builds for Linux distros
+          [
+            failFast: false,
+            axes: [
+              platform: 'centos7', 'centos8', 'bionic', 'focal', 'stretch', 'buster', 'bullseye'
+            ],
+            actions: {
+              stage("${platform}") {
+                agent {
+                  docker {
+                    image platform_images["${platform}"]
+                    label 'docker'
+                    args "${DOCKER_ARGS}"
+                    registryUrl 'https://docker.io/'
+                    registryCredentialsId 'dockerhub_creds'
+                  }
+                }
 
-            post {
-              cleanup {
-                sh 'rm -rf ${WORKSPACE}/*'
-              }
-            } // post
-          } // containerized platform
-        } // stages
+                options {
+                  skipDefaultCheckout()
+                  timeout(time: 90, unit: "MINUTES")
+                }
 
-      } // matrix
+                stages {
+                  stage('Build from tarball & test') {
+                    steps {
+                      sh( script: 'rm -rf apache-couchdb-*', label: 'Clean workspace' )
+                      unstash 'tarball'
+                      sh( script: unpack, label: 'Unpack tarball' )
+                      dir( "${platform}/build/couchdb" ) {
+                        sh 'pwd'
+                        sh 'ls -l'
+                        sh "./configure --skip-deps --spidermonkey-version ${spidermonkey[env.platform]}"
+                        sh 'make'
+                        sh 'make eunit'
+                        sh 'make elixir-suite'
+                        sh 'make exunit'
+                        sh 'make mango-test'
+                      }
+                    }
+                    post {
+                      always {
+                        junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
+                      }
+                      failure {
+                        dir( "${platform}/build/couchdb" ) {
+                          sh 'make build-report'
+                        }
+                      }
+                    }
+                  }
 
+                  stage('Build CouchDB packages') {
+                    steps {
+                      unstash 'tarball'
+                      sh( script: make_packages, label: 'Build packages' )
+                      sh( script: cleanup_and_save, label: 'Stage package artifacts for archival' )
+                    }
+                    post {
+                      success {
+                        archiveArtifacts artifacts: 'pkgs/**', fingerprint: true
+                      }
+                    }
+                  }
+                }
+
+                post {
+                  cleanup {
+                    sh 'rm -rf ${WORKSPACE}/*'
+                  }
+                } // post
+              } // containerized platform
+            }
+          ]
+        ])
+      }
     } // stage 'Test and Package'