Reputation: 2745
I have groovy postbuild script
def error = manager.getLogMatcher(".*(Error:(.*)))
if(error?.matches()) {
manager. addShortText(matcher.group(1))
}
Now I'm trying to convert this into declarative pipeline syntax
pipeline{
post{
failure{}
}
}
So In failure tab can I add groovy script? or I have to add stage? I see there is jenkins-badge-plugin but not sure how to add regex to find text and then add batch
Upvotes: 2
Views: 3457
Reputation: 1561
You just need to add script block inside failure as follows and there you can put your post build groovy script:
pipeline{
post{
failure{
script{
//Add your post build script code in case of failure
}
}
}
}
Upvotes: 3