У меня есть декларативный конвейер Jenkins, который прекрасно работает, когда статус сборки успешен.
Однако, когда тесты пользовательского интерфейса терпят неудачу, и статус сборки устанавливается как сбой, весь код в шаге post всегда игнорируется.
Я проверил, может быть, отчет о тестировании не создается в случае неудачных тестов, но они присутствуют в указанном месте.
Я понятия не имею, почему Дженкинс не будет запускать поствсегда шаг в случае неудачной сборки.
Я ожидаю, что шаг всегда будет выполняться как в неудачном, так и в успешном сценарии, может кто-нибудь объяснить мне, почему это не так?
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 */
}
}
}