I have the following console output from a jenkins build:
23:21:16 [ ERROR ] - Problem occured while installing the chart AbCdEfG , aborting!
if the line appears, i want to be able to get only AbCdEfG and put it in error message, or in a varaiable. i tried something like:
if (manager.logContains('.*\${error_string}')) {
error("Build failed because of ${AbCdEfG}")
regexp string that seems to be working, but stuck
[\n\r]*Problem occured while installing the chart:*([^\n\r]*)
Have you tested example 4 from plugin documentation? That example is using Java, not Groovy.
Anyway, the method
getLogMatcher
returns a Matcher, not a String.Calling
logContains
will evaluate the log twice.Using Groovy, (not tested inside Jenkins, only locally) you can adapt this snippet: