Jenkins report the name of the stage that failed
Store the STAGE_NAME in a variable and read it in the post-section
examples/jenkins/report_stage.jenkinsfile
pipeline { agent { label 'master' } stages { stage('first') { steps { script { last_started = env.STAGE_NAME echo "in first" def a = 0 def b = 10 / a } } } stage('second') { steps { script { last_started = env.STAGE_NAME echo "in second" } } } } post { failure { echo "last_started: $last_started" } } }
Published on 2019-05-01
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post