Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
chenjing
/
api-test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
a7e0df29
...
a7e0df29db0fea314a62bd98d1a9727695002b88
authored
2026-01-21 17:23:27 +0800
by
chenjing
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新配置
1 parent
599f8c77
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
Jenkinsfile
Jenkinsfile
View file @
a7e0df2
...
...
@@ -85,30 +85,46 @@ pipeline {
post {
always {
echo "正在收集测试结果..."
// 列出所有报告文件(调试用)
sh '''
echo "=== 报告文件清单 ==="
if [ -d "reports" ]; then
find reports -type f -name "*.html" -o -name "*.xlsx" | sort
else
echo "reports 目录不存在"
fi
echo "===================="
'''
// 归档报告文件
archiveArtifacts artifacts: 'reports/**/*
.{html,xlsx}
',
archiveArtifacts artifacts: 'reports/**/*',
allowEmptyArchive: true,
defaultExcludes: fals
e
fingerprint: tru
e
// 发布 HTML 报告到 Jenkins
script {
def reportDir = "reports/${env.DEPLOY_ENV}"
def htmlReports = sh(
script: "find ${reportDir} -maxdepth 1 -name '*.html' -type f | sort -r | head -1",
sh "ls -la ${reportDir} 2>/dev/null || echo 'Directory not found'"
def htmlFile = sh(
script: "find ${reportDir} -maxdepth 1 -name '*.html' -type f 2>/dev/null | sort -r | head -1 | xargs basename",
returnStdout: true
).trim()
if (html
Reports
) {
echo "找到
最新HTML报告: ${htmlReports
}"
if (html
File
) {
echo "找到
HTML报告: ${htmlFile
}"
publishHTML([
reportDir:
'.'
,
reportFiles: html
Reports
,
reportName: "
API Test Report (${env.DEPLOY_ENV})
",
reportDir:
reportDir
,
reportFiles: html
File
,
reportName: "
Test Report [${env.DEPLOY_ENV}]
",
keepAll: true,
alwaysLinkToLastBuild: true
alwaysLinkToLastBuild: true,
allowMissing: false
])
echo "HTML报告已发布到Jenkins"
} else {
echo "
未找到HTML报告文件
"
echo "
警告: 未找到HTML报告文件 (路径: ${reportDir})
"
}
}
}
...
...
Please
register
or
sign in
to post a comment