我有一个Jenkins声明性管道,当构建状态成功时,它运行得很好。
但是,当UI测试失败并且构建状态设置为“失败”时,总是忽略“发布”步骤中的所有代码。
我已经检查了在测试失败的情况下是否没有创建测试报告,但是这些报告存在于指定的位置。
我不知道为什么詹金斯不运行后总是一步一步,以防失败的建设。
我希望这篇文章总是在失败或成功的情况下运行,有人能向我解释为什么它不运行吗?
post {
always {
node('master') {
dir('/appl/jenkins/test/workspace/pipeline/test-reports') {
unstash 'test-report'
// This plugin script replaces the hard coded D:\ drive references with the path of the Jenkins job
// in order to make screenshot links function OK in the Jenkins copy of the HTML report.
//TODO add build number to report to identify test run.
echo 'Run completed before script block'
script {
contentReplace(
configs: [
fileContentReplaceConfig(
configs: [
fileContentReplaceItemConfig(
search: 'original_path',
replace: 'replaced_path',
matchCount: 0)
],
fileEncoding: 'UTF-8',
filePath: '/appl/jenkins/test/workspace/pipeline/test-reports/report.html')
])
}
echo 'Run completed after script block'
// Below we use the Publish HTML plugin to publish the report.html resulting from the Extend Reports plugin.
publishHTML target: [
allowMissing : false,
alwaysLinkToLastBuild: false,
keepAll : true,
reportDir : '/appl/jenkins/test/workspace/pipeline/test-reports',
reportFiles : 'report.html, *.png',
reportName : 'Extent Report deluxe (screenshots!)'
]
echo 'Run completed after publish block'
//deleteDir() /* clean up Master workspace */
}
}
}