Commit df35e221 authored by liguangyu06's avatar liguangyu06
Browse files

Keep SPD report email default and skip Allure/summary when workspace is missing.

parent 91831603
...@@ -66,7 +66,7 @@ pipeline { ...@@ -66,7 +66,7 @@ pipeline {
booleanParam(name: 'RUN_FULL', defaultValue: false, description: '包含 @full 全列排序(耗时长)') booleanParam(name: 'RUN_FULL', defaultValue: false, description: '包含 @full 全列排序(耗时长)')
string( string(
name: 'REPORT_EMAIL_TO', name: 'REPORT_EMAIL_TO',
defaultValue: '', defaultValue: 'liguangyu@sinopharm.com',
description: '测试报告收件人(同事邮箱,多个用英文逗号)。留空则读任务环境变量 REPORT_EMAIL_TO;都空则不发信' description: '测试报告收件人(同事邮箱,多个用英文逗号)。留空则读任务环境变量 REPORT_EMAIL_TO;都空则不发信'
) )
string(name: 'REPORT_EMAIL_CC', defaultValue: '', description: '抄送,逗号分隔,可选') string(name: 'REPORT_EMAIL_CC', defaultValue: '', description: '抄送,逗号分隔,可选')
...@@ -173,16 +173,16 @@ pipeline { ...@@ -173,16 +173,16 @@ pipeline {
} catch (err) { } catch (err) {
echo "跳过归档:${err}" echo "跳过归档:${err}"
} }
if (fileExists('reports/latest/summary.json')) { try {
try { 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))"' 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))"'
def desc = isUnix() def desc = isUnix()
? sh(script: descScript, returnStdout: true).trim() ? sh(script: descScript, returnStdout: true).trim()
: bat(script: "@echo off\n${descScript}", returnStdout: true).trim() : bat(script: "@echo off\n${descScript}", returnStdout: true).trim()
currentBuild.description = desc currentBuild.description = desc
} catch (err) {
echo "跳过构建描述:${err}"
} }
} catch (err) {
echo "跳过构建描述:${err}"
} }
try { try {
publishHTML([ publishHTML([
...@@ -196,26 +196,30 @@ pipeline { ...@@ -196,26 +196,30 @@ pipeline {
} catch (err) { } catch (err) {
echo "跳过 HTML 报告:${err}" echo "跳过 HTML 报告:${err}"
} }
if (fileExists('reports/latest/allure-results')) { try {
try { if (fileExists('reports/latest/allure-results')) {
allure includeProperties: false, jdk: '', results: [[path: 'reports/latest/allure-results']] try {
} catch (err) { allure includeProperties: false, jdk: '', results: [[path: 'reports/latest/allure-results']]
echo "Allure 插件不可用,已保留 reports/latest/allure-report:${err}" } catch (err) {
if (fileExists('reports/latest/allure-report/index.html')) { echo "Allure 插件不可用,已保留 reports/latest/allure-report:${err}"
try { 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}" } catch (ignored) {
echo "跳过 Allure HTML:${ignored}"
}
} }
} }
} }
} catch (err) {
echo "跳过 Allure:${err}"
} }
try { try {
withEnv(["BUILD_RESULT=${currentBuild.currentResult}"]) { withEnv(["BUILD_RESULT=${currentBuild.currentResult}"]) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment