Hi,
I'm not sure I understood your issue on calling functions. Maybe there is only a bit of confusion about the Jenkins pipeline syntax.
From what you said, you are already calling functions into the post sections: "cleanWs()" is a function, "emailext body: ... " is a function.
So, maybe you are confused by the fact Jenkins syntax in post doesn't allow something like:
post {
aFunction()
}
So, nope, the above doesn't work. Because the "post" syntax are blocks based on the result of the pipeline and you actually listed all possible options:
"always, changed, fixed, regression, aborted, success, unsuccessful, unstable, failure, notBuilt, cleanup"
And if I understood, you want to call a function that does different things depending on the pipeline result ... then, you need to used "always":
post {
always {
aFunction(BUILD_RESULT)
}
}
And then the function will do different things depending of the BUILD_RESULT value:
if (BUILD_RESULT == "SUCCESS") {
message = "Pipeline failed"
} else {
message = "Pipeline ... whatever"
}
I hope that helps.
Cheers,
Gianluca.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ea74e553-88a7-4925-ade2-27462aaceab1n%40googlegroups.com.