Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-playwright-web-spd
Commits
91831603
Commit
91831603
authored
Sep 14, 2026
by
liguangyu06
Browse files
Skip report publishing when Git checkout never reached the workspace.
parent
d74d1e15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Jenkinsfile
View file @
91831603
...
@@ -162,51 +162,73 @@ pipeline {
...
@@ -162,51 +162,73 @@ pipeline {
post
{
post
{
always
{
always
{
junit
allowEmptyResults:
true
,
testResults:
'reports/latest/junit.xml'
archiveArtifacts
artifacts:
'reports/latest/**, reports/ci-*/summary.json, reports/ci-*/meta.txt'
,
allowEmptyArchive:
true
,
fingerprint:
true
script
{
script
{
try
{
junit
allowEmptyResults:
true
,
testResults:
'reports/latest/junit.xml'
}
catch
(
err
)
{
echo
"跳过 JUnit(代码可能尚未检出):${err}"
}
try
{
archiveArtifacts
artifacts:
'reports/latest/**, reports/ci-*/summary.json, reports/ci-*/meta.txt'
,
allowEmptyArchive:
true
,
fingerprint:
true
}
catch
(
err
)
{
echo
"跳过归档:${err}"
}
if
(
fileExists
(
'reports/latest/summary.json'
))
{
if
(
fileExists
(
'reports/latest/summary.json'
))
{
def
descScript
=
'node -e "var s=require(\'./reports/latest/summary.json\'); var c=s.counts||{}; console.log(s.suite+\' shards=\'+s.shards+\' workers=\'+s.workers+\' fail=\'+(c.failures||0)+\'/\'+(c.tests||0))"'
try
{
def
desc
=
isUnix
()
def
descScript
=
'node -e "var s=require(\'./reports/latest/summary.json\'); var c=s.counts||{}; console.log(s.suite+\' shards=\'+s.shards+\' workers=\'+s.workers+\' fail=\'+(c.failures||0)+\'/\'+(c.tests||0))"'
?
sh
(
script:
descScript
,
returnStdout:
true
).
trim
()
def
desc
=
isUnix
()
:
bat
(
script:
"@echo off\n${descScript}"
,
returnStdout:
true
).
trim
()
?
sh
(
script:
descScript
,
returnStdout:
true
).
trim
()
currentBuild
.
description
=
desc
:
bat
(
script:
"@echo off\n${descScript}"
,
returnStdout:
true
).
trim
()
currentBuild
.
description
=
desc
}
catch
(
err
)
{
echo
"跳过构建描述:${err}"
}
}
try
{
publishHTML
([
allowMissing:
true
,
alwaysLinkToLastBuild:
true
,
keepAll:
true
,
reportDir:
'reports/latest/playwright-report'
,
reportFiles:
'index.html'
,
reportName:
'Playwright Report'
])
}
catch
(
err
)
{
echo
"跳过 HTML 报告:${err}"
}
}
}
publishHTML
([
allowMissing:
true
,
alwaysLinkToLastBuild:
true
,
keepAll:
true
,
reportDir:
'reports/latest/playwright-report'
,
reportFiles:
'index.html'
,
reportName:
'Playwright Report'
])
script
{
if
(
fileExists
(
'reports/latest/allure-results'
))
{
if
(
fileExists
(
'reports/latest/allure-results'
))
{
try
{
try
{
allure
includeProperties:
false
,
jdk:
''
,
results:
[[
path:
'reports/latest/allure-results'
]]
allure
includeProperties:
false
,
jdk:
''
,
results:
[[
path:
'reports/latest/allure-results'
]]
}
catch
(
err
)
{
}
catch
(
err
)
{
echo
"Allure 插件不可用,已保留 reports/latest/allure-report:${err}"
echo
"Allure 插件不可用,已保留 reports/latest/allure-report:${err}"
if
(
fileExists
(
'reports/latest/allure-report/index.html'
))
{
if
(
fileExists
(
'reports/latest/allure-report/index.html'
))
{
publishHTML
([
try
{
allowMissing:
true
,
publishHTML
([
alwaysLinkToLastBuild:
true
,
allowMissing:
true
,
keepAll:
true
,
alwaysLinkToLastBuild:
true
,
reportDir:
'reports/latest/allure-report'
,
keepAll:
true
,
reportFiles:
'index.html'
,
reportDir:
'reports/latest/allure-report'
,
reportName:
'Allure Report'
reportFiles:
'index.html'
,
])
reportName:
'Allure Report'
])
}
catch
(
ignored
)
{
echo
"跳过 Allure HTML:${ignored}"
}
}
}
}
}
}
}
withEnv
([
"BUILD_RESULT=${currentBuild.currentResult}"
])
{
try
{
if
(
isUnix
())
{
withEnv
([
"BUILD_RESULT=${currentBuild.currentResult}"
])
{
sh
'node scripts/ci-email-summary.mjs || true'
if
(
isUnix
())
{
}
else
{
sh
'node scripts/ci-email-summary.mjs || true'
bat
returnStatus:
true
,
script:
'node scripts\\ci-email-summary.mjs'
}
else
{
bat
returnStatus:
true
,
script:
'node scripts\\ci-email-summary.mjs'
}
}
}
sendReportEmail
()
}
catch
(
err
)
{
echo
"跳过邮件:${err}"
}
}
sendReportEmail
()
}
}
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment