HADOOP-17854. Run junit in Jenkins only if surefire reports exist (#3319)
This commit is contained in:
parent
fc566ad9b0
commit
c8e5864838
23
dev-support/Jenkinsfile
vendored
23
dev-support/Jenkinsfile
vendored
@ -24,6 +24,22 @@ def getGithubAndJiraCreds() {
|
||||
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 {
|
||||
|
||||
agent {
|
||||
@ -290,12 +306,7 @@ pipeline {
|
||||
reportName: 'Yetus Report'
|
||||
])
|
||||
|
||||
// Publish JUnit results
|
||||
try {
|
||||
junit "${SOURCEDIR}/**/target/surefire-reports/*.xml"
|
||||
} catch(e) {
|
||||
echo 'junit processing: ' + e.toString()
|
||||
}
|
||||
publishJUnitResults()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user