Reputation: 141
I am running two ant targets in my build compile(source compilation) and compile_tests(tests compilation). In post build action I have added option to create Mantis(bug tracking tool) ticket on build failure. But I only want to create ticket when my build fails on compile target.
Is there a way to use groovy script as a condition for running post build actions? Or any other way to do this task?
Upvotes: 0
Views: 1590
Reputation: 11045
A quick way to condition an action in the groovy post build is using the Jenkins API to get the build result.
Code example (do something if build failed):
if (manager.build.result == hudson.model.Result.FAILURE) {
// do you magic here
}
I hope this helps.
Upvotes: 1