|
@@ -24,6 +24,22 @@ def getGithubAndJiraCreds() {
|
|
usernameVariable: 'JIRA_USER')]
|
|
usernameVariable: 'JIRA_USER')]
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// Publish JUnit results only if there are XML files under surefire-reports
|
|
|
|
+def publishJUnitResults() {
|
|
|
|
+ def findCmdExitCode = sh script: "find ${SOURCEDIR} -wholename */target/surefire-reports/*.xml | egrep .", returnStatus: true
|
|
|
|
+ boolean surefireReportsExist = findCmdExitCode == 0
|
|
|
|
+ if (surefireReportsExist) {
|
|
|
|
+ echo "XML files found under surefire-reports, running junit"
|
|
|
|
+ try {
|
|
|
|
+ junit "${SOURCEDIR}/**/target/surefire-reports/*.xml"
|
|
|
|
+ } catch(e) {
|
|
|
|
+ echo 'junit processing: ' + e.toString()
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ echo "No XML files found under surefire-reports, skipping junit"
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
pipeline {
|
|
pipeline {
|
|
|
|
|
|
agent {
|
|
agent {
|
|
@@ -290,12 +306,7 @@ pipeline {
|
|
reportName: 'Yetus Report'
|
|
reportName: 'Yetus Report'
|
|
])
|
|
])
|
|
|
|
|
|
- // Publish JUnit results
|
|
|
|
- try {
|
|
|
|
- junit "${SOURCEDIR}/**/target/surefire-reports/*.xml"
|
|
|
|
- } catch(e) {
|
|
|
|
- echo 'junit processing: ' + e.toString()
|
|
|
|
- }
|
|
|
|
|
|
+ publishJUnitResults()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|