From 842adc6fcd1a7d233d3302ed7042b11261c407c8 Mon Sep 17 00:00:00 2001
From: Calen Pennington <cale@edx.org>
Date: Thu, 12 Dec 2019 13:45:00 -0500
Subject: [PATCH] Archive WTW artifacts and send splunk files at the end of the
 WTW collection phase

---
 scripts/Jenkinsfiles/bokchoy | 37 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/scripts/Jenkinsfiles/bokchoy b/scripts/Jenkinsfiles/bokchoy
index 3dafd9148eb..f8bcffdb53a 100644
--- a/scripts/Jenkinsfiles/bokchoy
+++ b/scripts/Jenkinsfiles/bokchoy
@@ -92,28 +92,25 @@ pipeline {
             steps {
                 script {
                     sshagent(credentials: ['jenkins-worker'], ignoreMissing: true) {
-                        checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: git_branch]],
-                            doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', honorRefspec: true,
-                            noTags: true, shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'jenkins-worker',
-                            refspec: git_refspec, url: "git@github.com:edx/${REPO_NAME}.git"]]]
+                        try {
+                            checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name: git_branch]],
+                                doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', honorRefspec: true,
+                                noTags: true, shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'jenkins-worker',
+                                refspec: git_refspec, url: "git@github.com:edx/${REPO_NAME}.git"]]]
 
-                        for (int i = 1; i <= shardCount; i++) {
-                            unstash "bok-choy-reports-${i}"
+                            for (int i = 1; i <= shardCount; i++) {
+                                unstash "bok-choy-reports-${i}"
+                            }
+                            sh """
+                            export TEST_SUITE=bok-choy
+                            source scripts/jenkins-common.sh
+                            paver coverage --rcfile=common/test/acceptance/.coveragerc
+                            paver upload_coverage_to_s3
+                            """
+                        } finally {
+                            archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/*.coverage'
+                            sendSplunkFile excludes: '', includes: '**/timing*.log', sizeLimit: '10MB'
                         }
-                        sh """
-                        export TEST_SUITE=bok-choy
-                        source scripts/jenkins-common.sh
-                        paver coverage --rcfile=common/test/acceptance/.coveragerc
-                        paver upload_coverage_to_s3
-                        """
-                    }
-                }
-            }
-            post {
-                always {
-                    script {
-                        archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/*.coverage'
-                        sendSplunkFile excludes: '', includes: '**/timing*.log', sizeLimit: '10MB'
                     }
                 }
             }
-- 
GitLab