In a shared library method I'm trying to execute a stage and a post step afterwards:
def call(String name = 'human') {
echo "Hello, ${name}."
this.stage("mystage"){
this.node('master') {
this.sh('echo executing stage')
}
}
this.post {
failure {
echo 'This step failed!'
}
}
}
It gives an error No such DSL method 'post' found among steps
.
The post step can be used fine in a "normal" pipeline script like this:
https://jenkins.io/doc/book/pipeline/syntax/#post
Is there a way to use it inside a shared library?
Cheers!