build file
Some checks failed
test/timeline-server/pipeline/head There was a failure building this commit
Some checks failed
test/timeline-server/pipeline/head There was a failure building this commit
This commit is contained in:
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@@ -55,12 +55,23 @@ pipeline {
|
|||||||
always {
|
always {
|
||||||
script {
|
script {
|
||||||
// 检查测试报告文件是否存在
|
// 检查测试报告文件是否存在
|
||||||
def reportFiles = findFiles(glob: 'target/surefire-reports/TEST-*.xml')
|
def testReportDir = 'target/surefire-reports'
|
||||||
if (reportFiles.length > 0) {
|
def hasReportDir = fileExists testReportDir
|
||||||
echo "找到 ${reportFiles.length} 个测试报告文件"
|
|
||||||
junit testResults: 'target/surefire-reports/TEST-*.xml'
|
if (hasReportDir) {
|
||||||
|
def reportCount = sh(
|
||||||
|
script: "find ${testReportDir} -name 'TEST-*.xml' | wc -l",
|
||||||
|
returnStdout: true
|
||||||
|
).trim() as int
|
||||||
|
|
||||||
|
if (reportCount > 0) {
|
||||||
|
echo "找到 ${reportCount} 个测试报告文件"
|
||||||
|
junit testResults: 'target/surefire-reports/TEST-*.xml'
|
||||||
|
} else {
|
||||||
|
echo "未找到测试报告文件,跳过JUnit发布"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "未找到测试报告文件,跳过JUnit发布"
|
echo "未找到测试报告目录,跳过JUnit发布"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user