Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35262

Warnings plugin - regex fails to detect pattern whereas it is correctly detected when declaring the regex in System Configuration page

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-plugin
    • warnings-plugin 4.52
      Jenkins 1.648

      Hello,

      I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page

      Here are all the details of my sample:
      I created the following sample regex in the System Configuration page:

      (start(?:(?!start)[\s\S])*?end   step: runtimedata.*)
      

      With the following Groovy script:

      import hudson.plugins.warnings.parser.Warning
      import hudson.plugins.analysis.util.model.Priority
      String type = "TEST"
      String category = "runtimedata"
      String errors = matcher.group(1)
      return new Warning("", 0, type, category, errors, Priority.HIGH);
      

      It is supposed to retrieve the lines in red in the following sample:
      start step: at 06/01/2016-12:05:42
      end step: jsruler at 06/01/2016-12:05:42
      start step: at 06/01/2016-12:05:42
      some details here
      on several lines
      end step: runtimedata at 06/01/2016-12:05:42

      start step: at 06/01/2016-12:05:42
      end step: dummynls at 06/01/2016-12:05:42

      This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:

      One warning found
      file name: 
      line number: 0
      priority: High Priority
      category:  headerruler
      type: TEST
      message: start step: runtimed[...]data   at 06/01/2016-12:05:42
      

      FYI, I've also tested the regex in several online tools and it works.

      However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
      Please note that this behavior happens only with regex with the pattern (??!someString)

      I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

      I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

      Best Regards,
      Tyoneb

          [JENKINS-35262] Warnings plugin - regex fails to detect pattern whereas it is correctly detected when declaring the regex in System Configuration page

          Benoît CHOMEL created issue -
          Benoît CHOMEL made changes -
          Description Original: Hello,

          I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page :(

          +Here are all the details of my sample:+
          I created the following sample regex in the System Configuration page:
          (start(?:(?!start)[\s\S])*?end step: runtimedata.*)

          With the following Groovy script:
          import hudson.plugins.warnings.parser.Warning
          import hudson.plugins.analysis.util.model.Priority
          String type = "TEST"
          String category = "runtimedata"
          String errors = matcher.group(1)
          return new Warning("", 0, type, category, errors, Priority.HIGH);

          It is supposed to retrieve the lines in red in the following sample:
          start step: at 06/01/2016-12:05:42
          end step: jsruler at 06/01/2016-12:05:42
          {color:#d04437}start step: at 06/01/2016-12:05:42
          some details here
          on several lines
          end step: runtimedata at 06/01/2016-12:05:42{color}
          start step: at 06/01/2016-12:05:42
          end step: dummynls at 06/01/2016-12:05:42

          This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:
          One warning found
          file name:
          line number: 0
          priority: High Priority
          category: headerruler
          type: TEST
          message: start step: runtimed[...]data at 06/01/2016-12:05:42

          FYI, I've also tested the regex in several online tools and it works.

          However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
          Please note that this behavior happens only with regex with the pattern (?:(?!someString)

          I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

          I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

          Best Regards,
          Tyoneb
          New: Hello,

          I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page :(

          +Here are all the details of my sample:+
          I created the following sample regex in the System Configuration page:

          {code:java}
          (start(?:(?!start)[\s\S])*?end step: runtimedata.*)
          {code}


          With the following Groovy script:
          import hudson.plugins.warnings.parser.Warning
          import hudson.plugins.analysis.util.model.Priority
          String type = "TEST"
          String category = "runtimedata"
          String errors = matcher.group(1)
          return new Warning("", 0, type, category, errors, Priority.HIGH);

          It is supposed to retrieve the lines in red in the following sample:
          start step: at 06/01/2016-12:05:42
          end step: jsruler at 06/01/2016-12:05:42
          {color:#d04437}start step: at 06/01/2016-12:05:42
          some details here
          on several lines
          end step: runtimedata at 06/01/2016-12:05:42{color}
          start step: at 06/01/2016-12:05:42
          end step: dummynls at 06/01/2016-12:05:42

          This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:
          One warning found
          file name:
          line number: 0
          priority: High Priority
          category: headerruler
          type: TEST
          message: start step: runtimed[...]data at 06/01/2016-12:05:42

          FYI, I've also tested the regex in several online tools and it works.

          However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
          Please note that this behavior happens only with regex with the pattern (?:(?!someString)

          I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

          I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

          Best Regards,
          Tyoneb
          Benoît CHOMEL made changes -
          Description Original: Hello,

          I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page :(

          +Here are all the details of my sample:+
          I created the following sample regex in the System Configuration page:

          {code:java}
          (start(?:(?!start)[\s\S])*?end step: runtimedata.*)
          {code}


          With the following Groovy script:
          import hudson.plugins.warnings.parser.Warning
          import hudson.plugins.analysis.util.model.Priority
          String type = "TEST"
          String category = "runtimedata"
          String errors = matcher.group(1)
          return new Warning("", 0, type, category, errors, Priority.HIGH);

          It is supposed to retrieve the lines in red in the following sample:
          start step: at 06/01/2016-12:05:42
          end step: jsruler at 06/01/2016-12:05:42
          {color:#d04437}start step: at 06/01/2016-12:05:42
          some details here
          on several lines
          end step: runtimedata at 06/01/2016-12:05:42{color}
          start step: at 06/01/2016-12:05:42
          end step: dummynls at 06/01/2016-12:05:42

          This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:
          One warning found
          file name:
          line number: 0
          priority: High Priority
          category: headerruler
          type: TEST
          message: start step: runtimed[...]data at 06/01/2016-12:05:42

          FYI, I've also tested the regex in several online tools and it works.

          However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
          Please note that this behavior happens only with regex with the pattern (?:(?!someString)

          I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

          I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

          Best Regards,
          Tyoneb
          New: Hello,

          I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page :(

          +Here are all the details of my sample:+
          I created the following sample regex in the System Configuration page:

          {code:java}
          (start(?:(?!start)[\s\S])*?end step: runtimedata.*)
          {code}


          With the following Groovy script:

          {code:java}
          import hudson.plugins.warnings.parser.Warning
          import hudson.plugins.analysis.util.model.Priority
          String type = "TEST"
          String category = "runtimedata"
          String errors = matcher.group(1)
          return new Warning("", 0, type, category, errors, Priority.HIGH);
          {code}


          It is supposed to retrieve the lines in red in the following sample:

          {code:java}
          start step: at 06/01/2016-12:05:42
          end step: jsruler at 06/01/2016-12:05:42
          {color:#d04437}start step: at 06/01/2016-12:05:42
          some details here
          on several lines
          end step: runtimedata at 06/01/2016-12:05:42{color}
          start step: at 06/01/2016-12:05:42
          end step: dummynls at 06/01/2016-12:05:42
          {code}


          This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:

          {code:java}
          One warning found
          file name:
          line number: 0
          priority: High Priority
          category: headerruler
          type: TEST
          message: start step: runtimed[...]data at 06/01/2016-12:05:42
          {code}


          FYI, I've also tested the regex in several online tools and it works.

          However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
          Please note that this behavior happens only with regex with the pattern (?:(?!someString)

          I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

          I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

          Best Regards,
          Tyoneb
          Benoît CHOMEL made changes -
          Description Original: Hello,

          I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page :(

          +Here are all the details of my sample:+
          I created the following sample regex in the System Configuration page:

          {code:java}
          (start(?:(?!start)[\s\S])*?end step: runtimedata.*)
          {code}


          With the following Groovy script:

          {code:java}
          import hudson.plugins.warnings.parser.Warning
          import hudson.plugins.analysis.util.model.Priority
          String type = "TEST"
          String category = "runtimedata"
          String errors = matcher.group(1)
          return new Warning("", 0, type, category, errors, Priority.HIGH);
          {code}


          It is supposed to retrieve the lines in red in the following sample:

          {code:java}
          start step: at 06/01/2016-12:05:42
          end step: jsruler at 06/01/2016-12:05:42
          {color:#d04437}start step: at 06/01/2016-12:05:42
          some details here
          on several lines
          end step: runtimedata at 06/01/2016-12:05:42{color}
          start step: at 06/01/2016-12:05:42
          end step: dummynls at 06/01/2016-12:05:42
          {code}


          This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:

          {code:java}
          One warning found
          file name:
          line number: 0
          priority: High Priority
          category: headerruler
          type: TEST
          message: start step: runtimed[...]data at 06/01/2016-12:05:42
          {code}


          FYI, I've also tested the regex in several online tools and it works.

          However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
          Please note that this behavior happens only with regex with the pattern (?:(?!someString)

          I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

          I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

          Best Regards,
          Tyoneb
          New: Hello,

          I have an issue with a regex that does not trigger any warning when set as a console output parser in a job, but seems to be correctly formatted and working in the System Configuration page :(

          +Here are all the details of my sample:+
          I created the following sample regex in the System Configuration page:

          {code:java}
          (start(?:(?!start)[\s\S])*?end step: runtimedata.*)
          {code}


          With the following Groovy script:

          {code:java}
          import hudson.plugins.warnings.parser.Warning
          import hudson.plugins.analysis.util.model.Priority
          String type = "TEST"
          String category = "runtimedata"
          String errors = matcher.group(1)
          return new Warning("", 0, type, category, errors, Priority.HIGH);
          {code}


          It is supposed to retrieve the lines in red in the following sample:
          start step: at 06/01/2016-12:05:42
          end step: jsruler at 06/01/2016-12:05:42
          {color:#d04437}start step: at 06/01/2016-12:05:42
          some details here
          on several lines
          end step: runtimedata at 06/01/2016-12:05:42{color}
          start step: at 06/01/2016-12:05:42
          end step: dummynls at 06/01/2016-12:05:42


          This works correctly when I create the regex and put the exact same sample text in the "Example Log Message" field:

          {code:java}
          One warning found
          file name:
          line number: 0
          priority: High Priority
          category: headerruler
          type: TEST
          message: start step: runtimed[...]data at 06/01/2016-12:05:42
          {code}


          FYI, I've also tested the regex in several online tools and it works.

          However, when I run a job with the exact same trace in the console output and set the corresponding regex to parse it, no warning is found.
          Please note that this behavior happens only with regex with the pattern (?:(?!someString)

          I looked for answers in forums and such but I haven't been able find anyone else encountering this issue. Since I feel like it is specific to some regex patterns, it might be that nobody else tried this...

          I hope you can find the explanation and correct this, it is quite a pain for me to work around this! Feel free to request any additional information I might have forgotten.

          Best Regards,
          Tyoneb

          Ulli Hafner added a comment -

          Internally, the regexp is scanned for a \n character. If present, then multiple lines are passed to the parser. If not, only a single line is passed.

          Ulli Hafner added a comment - Internally, the regexp is scanned for a \n character. If present, then multiple lines are passed to the parser. If not, only a single line is passed.

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/resources/hudson/plugins/warnings/GroovyParser/config.properties
          src/main/resources/hudson/plugins/warnings/GroovyParser/config_de.properties
          http://jenkins-ci.org/commit/warnings-plugin/a9c512cbc450a92f6bc0697d9e4cbfa238776057
          Log:
          [FIXED JENKINS-35262] Clarified help message.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/resources/hudson/plugins/warnings/GroovyParser/config.properties src/main/resources/hudson/plugins/warnings/GroovyParser/config_de.properties http://jenkins-ci.org/commit/warnings-plugin/a9c512cbc450a92f6bc0697d9e4cbfa238776057 Log: [FIXED JENKINS-35262] Clarified help message.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Hi Ulli,

          Thanks a lot for looking into this so quickly, and identifying the incorrect help message.

          However, I made some tests today and I have 2 feedbacks:

          1. 1. When I change my regex to add a \n character in it, it still does not find any warning. So my initial issue is not solved. Am I doing something wrong or should I reopen this ticket?
          (## start(?:(?!start)[\s\S])*?## end   step: headerruler.*\n)
          
          1. 2. There is still a discrepancy between the behavior of the regex parser when in the System Configuration page (which finds a Warning as is expected) and the regex parser in a job (which does not find any result). I agree that this issue is not as critical as the first one but it makes the analysis and convergence of a regex much harder... Plus it's very confusing for the end-user.

          Have you tried the sample I provided on your side?

          Best Regards,
          Tyoneb

          Benoît CHOMEL added a comment - Hi Ulli, Thanks a lot for looking into this so quickly, and identifying the incorrect help message. However, I made some tests today and I have 2 feedbacks: 1. When I change my regex to add a \n character in it, it still does not find any warning. So my initial issue is not solved. Am I doing something wrong or should I reopen this ticket? (## start(?:(?!start)[\s\S])*?## end step: headerruler.*\n) 2. There is still a discrepancy between the behavior of the regex parser when in the System Configuration page (which finds a Warning as is expected) and the regex parser in a job (which does not find any result). I agree that this issue is not as critical as the first one but it makes the analysis and convergence of a regex much harder... Plus it's very confusing for the end-user. Have you tried the sample I provided on your side? Best Regards, Tyoneb

          Unfortunately, my issue is not fixed by adding a \n in the regex. Please see my previous message for details.

          Benoît CHOMEL added a comment - Unfortunately, my issue is not fixed by adding a \n in the regex. Please see my previous message for details.
          Benoît CHOMEL made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

            drulli Ulli Hafner
            tyoneb Benoît CHOMEL
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: