Title: Message Title
Geanina Sz created an issue
Jenkins / JENKINS-56736
strage behavior of manager.logContains() API in Groovy Post Build plugin
Issue Type:
Task
Assignee:
Stefan Wolf
Components:
groovy-postbuild-plugin
Created:
2019-03-25 09:42
Priority:
Major
Reporter:
Geanina Sz
Hi, Trying to use Groovy Post build plugin in order to parse build output log in reverse order. manager.logContains seems not to be suitable for my since it always parse the log from the begging and I am using a variable in my scripted pipeline as a matcher which needs to be updated with latest value found in the console output. This seems not to be happening. The scenario is: in the same build log I have several text lines like: Failed: *. In case I find Failed: 0, I do something, in case of Failed: anything but 0, I do something else. Using: if(manager.logContains(".Failed: 0.")) {if(manager.logContains(".Failed: 0.")) { println "No failure" println "+ ${manager.logContains(".Failed: 0.")}" } else if(matcher?.matches()){ echo 'Matches!!' buildMsg=matcher.group(1).toInteger() if ((buildMsg - failure)> 0) { println 'There are tests failed!' // manager.buildUnstable() throw new RuntimeException("Failed") } } this does not work properly. Can you please help to solve this? Thank you!