diff --git a/buildenv/jenkins/JenkinsfileBase b/buildenv/jenkins/JenkinsfileBase index bb981dc6b7..426799bcdd 100644 --- a/buildenv/jenkins/JenkinsfileBase +++ b/buildenv/jenkins/JenkinsfileBase @@ -1789,6 +1789,15 @@ def archiveChildJobTap(childJobs, originalStatus = 'SUCCESS') { echo 'Exception: ' + e.toString() echo "Cannot copy *.tap or AQACert.log from ${name} with buildid ${buildId} . Skipping copyArtifacts..." } + // Aggregate JUnit XML results from child job to parent level (see #6238) + try { + timeout(time: 1, unit: 'HOURS') { + copyArtifacts (projectName: "${name}", selector: specific("${buildId}"), filter: "**/work/**/*.jtr.xml, **/result/**/*.jtr.xml, **/junitreports/**/*.xml, **/external_test_reports/**/*.xml", target:"${name}/${buildId}", optional: true) + } + } catch (Exception e) { + echo 'Exception: ' + e.toString() + echo "Cannot copy JUnit XML from ${name} with buildid ${buildId} . Skipping..." + } def childBuildUrl = "${env.JENKINS_URL}job/${name}/${buildId}" def badgeUrl = "${childBuildUrl}/badge/icon" def duration = cjob.getDuration() ?: "" @@ -1810,6 +1819,13 @@ def archiveChildJobTap(childJobs, originalStatus = 'SUCCESS') { childJobStatus += "" currentBuild.description = (currentBuild.description) ? currentBuild.description + "
" + childJobStatus : childJobStatus + // Publish aggregated JUnit results from all child jobs at the parent level (see #6238) + try { + junit skipMarkingBuildUnstable: true, allowEmptyResults: true, keepLongStdio: true, testResults: '**/work/**/*.jtr.xml, **/result/**/*.jtr.xml, **/junitreports/**/*.xml, **/external_test_reports/**/*.xml' + } catch (Exception e) { + echo "Caught exception when aggregating JUnit results at parent level: ${e.message}" + } + // In case rerun job status be worse than original job status if ( originalStatus != "SUCCESS" && isWorseThan( currentStatus, originalStatus)) { currentStatus = originalStatus