From 3e28f90ed88da166a2e601ea8bcfe3410bd7ecc1 Mon Sep 17 00:00:00 2001
From: Jeremy Bowman <jbowman@edx.org>
Date: Wed, 6 Feb 2019 14:15:54 -0500
Subject: [PATCH] TE-2851 Preserve stdout on Jenkins test failures

---
 scripts/Jenkinsfiles/bokchoy | 7 ++-----
 scripts/Jenkinsfiles/lettuce | 7 ++-----
 scripts/Jenkinsfiles/python  | 7 ++-----
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/scripts/Jenkinsfiles/bokchoy b/scripts/Jenkinsfiles/bokchoy
index 4a5c16165c4..f1bc28ba7c4 100644
--- a/scripts/Jenkinsfiles/bokchoy
+++ b/scripts/Jenkinsfiles/bokchoy
@@ -13,15 +13,12 @@ def runBokchoyTests() {
             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"]]]
-        console_output = sh(returnStdout: true, script: 'bash scripts/all-tests.sh').trim()
-        dir('stdout') {
-            writeFile file: "${TEST_SUITE}-${SHARD}-stdout.log", text: console_output
-        }
+        sh 'bash scripts/all-tests.sh'
     }
 }
 
 def bokchoyTestCleanup() {
-    archiveArtifacts allowEmptyArchive: true, artifacts: 'test_root/log/**/*.log,test_root/log/**/*.png,stdout/*.log'
+    archiveArtifacts allowEmptyArchive: true, artifacts: 'test_root/log/**/*.log,test_root/log/**/*.png'
     junit '**/reports/bok_choy/**/xunit.xml'
 }
 
diff --git a/scripts/Jenkinsfiles/lettuce b/scripts/Jenkinsfiles/lettuce
index 5bdce3df51e..5eeffd24add 100644
--- a/scripts/Jenkinsfiles/lettuce
+++ b/scripts/Jenkinsfiles/lettuce
@@ -12,15 +12,12 @@ def runLettuceTests() {
             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"]]]
-        console_output = sh(returnStdout: true, script: 'bash scripts/all-tests.sh').trim()
-        dir('stdout') {
-            writeFile file: "${TEST_SUITE}-stdout.log", text: console_output
-        }
+        sh 'bash scripts/all-tests.sh'
     }
 }
 
 def lettuceTestCleanup() {
-    archiveArtifacts allowEmptyArchive: true, artifacts: 'test_root/log/**/*.log,stdout/*.log,*.log'
+    archiveArtifacts allowEmptyArchive: true, artifacts: 'test_root/log/**/*.log,*.log'
     junit '**/reports/acceptance/*.xml'
 }
 
diff --git a/scripts/Jenkinsfiles/python b/scripts/Jenkinsfiles/python
index f820d032ea1..12be76bc3d7 100644
--- a/scripts/Jenkinsfiles/python
+++ b/scripts/Jenkinsfiles/python
@@ -12,16 +12,13 @@ def runPythonTests() {
             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"]]]
-        console_output = sh(returnStdout: true, script: 'bash scripts/all-tests.sh').trim()
-        dir('stdout') {
-            writeFile file: "${TEST_SUITE}-stdout.log", text: console_output
-        }
+        sh 'bash scripts/all-tests.sh'
         stash includes: 'reports/**/*coverage*', name: "${TEST_SUITE}-reports"
     }
 }
 
 def pythonTestCleanup() {
-    archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/**/*,test_root/log/**/*.log,**/nosetests.xml,stdout/*.log,*.log'
+    archiveArtifacts allowEmptyArchive: true, artifacts: 'reports/**/*,test_root/log/**/*.log,**/nosetests.xml,*.log'
     junit '**/nosetests.xml'
     sh '''source $HOME/edx-venv/bin/activate
     bash scripts/xdist/terminate_xdist_nodes.sh'''
-- 
GitLab