Rocketboy235
Rocketboy235

Reputation: 87

How to properly parse multiline warnings using Jenkins Warnings Next Generation Plugin?

I am trying to get the Jenkins Warnings Next Generation plugin to be able to parse warning messages that span multiple lines but unfortunately the plugin only matches one line and cannot do multiline?

In the configuration for the plugin, there is a feature where it shows a preview when you try out your regular expression. In the preview, it seems to work fine and catches my example warning but when it tries to parse through the console output for warnings, it fails to catchy any (all my warnings span multiple lines).

Not exactly sure why it's not working in the real output but is working in the preview. The plugin is able to catch multiple warnings if the match is only 1 line.

You can see what I have done here: https://regexr.com/4o3lq

I am currently using this for regular expression to input into the plugin configuration

(?ms)\x08(.*?)\x08

The warning is encapsulated by the \x08 special character (see regexr). I thought that the mode modifier (m and s) would allow multiline but apparently not.

Thanks in advance!

Upvotes: 2

Views: 686

Answers (1)

Rocketboy235
Rocketboy235

Reputation: 87

Was able to resolve my issue.

The Jenkins warnings parser preview is a bit misleading since I thought the previous Regex would be good enough to catch multiple line warnings but apparently the \r needs to be included. Within the plugin source code, there is a check that sees if a \r or \n is included in the Regular Expression and if there is, the Groovy Parser plugin will enable multiline support.

(?ms)\x08(.*?)\r?\x08

May or may not need the "m" in the mode modifier.

Upvotes: 1

Related Questions