From bd436e640d1db572389222ec1ddab691e5bf0beb Mon Sep 17 00:00:00 2001 From: Ramzi El-Yafi Date: Fri, 20 Dec 2019 10:11:26 +0000 Subject: [PATCH] Fix report generation against regression builds (#5818) --- .ci/dev/regression/Jenkinsfile | 41 +++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/.ci/dev/regression/Jenkinsfile b/.ci/dev/regression/Jenkinsfile index 9447598306..99aa0d1a64 100644 --- a/.ci/dev/regression/Jenkinsfile +++ b/.ci/dev/regression/Jenkinsfile @@ -52,7 +52,46 @@ pipeline { always { archiveArtifacts artifacts: '**/pod-logs/**/*.log', fingerprint: false junit '**/build/test-results-xml/**/*.xml' - allure includeProperties: false, jdk: '', results: [[path: '**/build/test-results-xml/**']] + + script { + try { + /* + * Copy all JUnit results files into a single top level directory. + * This is necessary to stop the allure plugin from hitting out + * of memory errors due to being passed many directories with + * long paths. + * + * File names are pre-pended with the pod number when + * copied to avoid collisions between files where the same test + * classes have run on multiple pods. + */ + sh label: 'Compact test results', + script: + '''#!/bin/bash + shopt -s globstar + rm -rf allure-input + mkdir allure-input + + for i in **/test-results-xml/**/test-runs/test-reports/** + do + [ -f $i ] && + cp $i allure-input/$(echo $i | sed -e \\ + \'s/.*test-results-xml\\/.*-\\(.*\\)\\/test-runs\\/.*\\/\\(.*\\)$/\\1\\-\\2/\') + done + + echo "Finished compacting JUnit results" + ''' + allure includeProperties: false, + jdk: '', + results: [[path: '**/allure-input']] + } catch (err) { + echo("Allure report generation failed: $err") + + if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) { + currentBuild.result = 'UNSTABLE' + } + } + } } cleanup { deleteDir() /* clean up our workspace */