Установлено Jenkins 2.89.4 + Pipeline плагины
Код пайплайна:
pipeline{
agent any
stages{
stage('INIT'){
steps{
script{
error 'My Error in Stage'
}
}
}
}
post{
success {
echo "post success"
}
failure{
echo "post failure"
}
}
}
В логе Jenkins видим следующие строки:
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in d:\tmp\JenkinsWS\TEST
[Pipeline] {
[Pipeline] stage
[Pipeline] { (INIT)
[Pipeline] script
[Pipeline] {
[Pipeline] error
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] echo
post failure
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: My Error in Stage
Finished: FAILURE
Вопрос: как получить в post.failure блоке значение
My Error in Stage