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

kocolosk pushed a commit to branch jenkins-junit-reports-and-jenkins-env
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to 
refs/heads/jenkins-junit-reports-and-jenkins-env by this push:
     new 528fba0  Play with sequential stages
528fba0 is described below

commit 528fba07a6396c61bd382cddca1ce1d166305996
Author: Adam Kocoloski <[email protected]>
AuthorDate: Tue Aug 6 00:06:14 2019 -0400

    Play with sequential stages
---
 Jenkinsfile | 76 +++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 41 insertions(+), 35 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index cb474a2..cae2fe3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,7 +35,7 @@ ls -l
 ./configure --with-curl
 '''
 
-make_check = '''
+build_and_test = '''
 pwd
 cd ${builddir}/apache-couchdb-*
 pwd
@@ -63,33 +63,32 @@ mv ${builddir}/apache-couchdb-*/rpmbuild/RPMS/$(arch)/*rpm 
${WORKSPACE}/pkgs/${p
 mv ${builddir}/apache-couchdb-*/couchdb/*.deb ${WORKSPACE}/pkgs/${platform} || 
true
 '''
 
+copy_test_results = '''
+rsync -av \
+      --include="*/" \
+      --include="*/.eunit/*.xml" \
+      --exclude="*" \
+      --prune-empty-dirs \
+      ${builddir}/apache-couchdb-*/src \
+      ${WORKSPACE}'
+'''
+
 build_script = '''
 mkdir -p ${COUCHDB_IO_LOG_DIR}
 
-set
-
-echo "Contents of Workspace"
-ls -l ${WORKSPACE}
-
-echo "Contents of builddir"
-ls -l ${builddir}
-
 echo
 echo "Build CouchDB from tarball & test"
+builddir=$(mktemp -d)
 cd ${builddir}
-rm -rf apache-couchdb-*
 tar -xf ${WORKSPACE}/apache-couchdb-*.tar.gz
 cd apache-couchdb-*
 ./configure --with-curl
-make
-make eunit apps=couch || (build-aux/logfile-uploader.py && false)
-find . -name "*.xml"
+make check || (build-aux/logfile-uploader.py && false)
 
 echo
 echo "Build CouchDB packages"
 cd ${builddir}
 git clone https://github.com/apache/couchdb-pkg
-rm -rf couchdb
 mkdir couchdb
 cp ${WORKSPACE}/apache-couchdb-*.tar.gz couchdb
 tar -xf ${WORKSPACE}/apache-couchdb-*.tar.gz -C couchdb
@@ -102,6 +101,7 @@ rm -rf ${WORKSPACE}/pkgs/${platform}
 mkdir -p ${WORKSPACE}/pkgs/${platform}
 mv ../rpmbuild/RPMS/$(arch)/*rpm ${WORKSPACE}/pkgs/${platform} || true
 mv ../couchdb/*.deb ${WORKSPACE}/pkgs/${platform} || true
+rm -rf ${builddir} ${COUCHDB_IO_LOG_DIR}
 '''
 
 pipeline {
@@ -196,20 +196,16 @@ pipeline {
         //       sh '''
         //         mkdir -p $COUCHDB_IO_LOG_DIR
 
-        //         env
-
         //         # Build CouchDB from tarball & test
-        //         cd ${BUILDDIR}
-        //         mkdir -p build
-        //         cd build
+        //         builddir=$(mktemp -d)
+        //         cd $builddir
         //         tar -xf $WORKSPACE/apache-couchdb-*.tar.gz
         //         cd apache-couchdb-*
         //         ./configure --with-curl
-        //         gmake eunit || (build-aux/logfile-uploader.py && false)
-
-        //         find . -name "*.xml"
+        //         gmake check || (build-aux/logfile-uploader.py && false)
 
         //         # No package build for FreeBSD at this time
+        //         rm -rf $builddir $COUCHDB_IO_LOG_DIR
         //       '''
         //     } // withEnv
         //   } // steps
@@ -240,21 +236,31 @@ pipeline {
             platform = 'centos6'
             builddir = pwd tmp:true
           }
-          steps {
-            sh 'rm -rf apache-couchdb-*'
-            unstash 'tarball'
-            sh( script: preamble, label: "Environment Details" )
-            sh( script: configure_tarball, label: "Configure CouchDB from 
tarball" )
-            sh( script: make_check, label: "Build CouchDB and run test suite" )
-            sh( script: make_packages, label: "Build CouchDB packages" )
-            sh( script: cleanup, label: "Cleanup & save for posterity")
-
-          } // steps
+          stages {
+            stage('Allocate Unique Workspace [JENKINS-57454]') {
+              steps {
+                ws 'workspace/${JOB_NAME}-centos6-${platform}'
+              }
+            }
+            stage('Build CouchDB from tarball & test') {
+              steps {
+                sh 'rm -rf apache-couchdb-*'
+                unstash 'tarball'
+                sh( script: preamble, label: "Environment Details" )
+                sh( script: configure_tarball, label: "Configure CouchDB from 
tarball" )
+                sh( script: build_and_test, label: "Build CouchDB and run test 
suite" )
+              }
+            }
+            stage('Build CouchDB packages') {
+              steps {
+                sh( script: make_packages )
+              }
+            }
+          } // stages
           post {
             always {
-              sh 'rsync -av --include="*/" --include="*/.eunit/*.xml" 
--exclude="*" \
-                      --prune-empty-dirs ${builddir}/apache-couchdb-*/src 
${WORKSPACE}'
-              junit '**/.eunit/*.xml'
+              sh ( script: copy_test_results )
+              junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml'
             }
             success {
               archiveArtifacts artifacts: 'pkgs/**', fingerprint: true

Reply via email to