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

Custom compiler warning for error parsing is not detecting the errors

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • warnings-plugin
    • Ubuntu Linux

      Regular expression is unable to figure out error pattern.
      This bug is in follow up of thread : https://groups.google.com/forum/#!topic/jenkinsci-users/uWI6SU9GVQg

      Global configuration

      Name: Puppet-Error-Parser
      Link name: Puppet-Error-Parser
      Tredn report name : Puppet Error Trend
      Regular Expression: ^.*(err:) (.*)at(.*\.pp):(\d+)$
      

      Mapping script:

      import hudson.plugins.warnings.parser.Warning
      
      String category = matcher.group(1)
      String message = matcher.group(2)
      String fileName = matcher.group(3)
      String lineNumber = matcher.group(4)
      
      
      return new Warning(fileName, Integer.parseInt(lineNumber), "Dynamic Parser", category, message);
      

      Example Log Message:

      19:35:11 err: Could not parse for environment production: Syntax error at '{'; expected '}' at /home/build/jenkins/workspace/puppet-parser-try/modules/profile/manifests/mongodb/abc/shard/master.pp:5
      

      output of regular expression matching
      One warning found
      file name: /home/build/jenkin[...]ongodb/abc/shard/master.pp
      line number: 5
      priority: Normal Priority
      category: err:
      type: Dynamic Parser
      message: Could not parse for [...]apos;; expected '}'

        1. aggregated-warnings.xml
          0.1 kB
        2. aggregated-warnings.xml
          0.1 kB
        3. changelog.xml
          0.0 kB
        4. changelog.xml
          0.0 kB
        5. console-log.txt
          35 kB
        6. console-log.txt
          35 kB
        7. hudson.plugins.warnings.WarningsPublisher.xml
          3 kB
        8. log
          260 kB
        9. log
          260 kB
        10. PuppetErrorParser-warnings.xml
          0.1 kB
        11. puppet-parser-global-configuration.JPG
          puppet-parser-global-configuration.JPG
          119 kB
        12. regexp.txt
          0.0 kB

          [JENKINS-20277] Custom compiler warning for error parsing is not detecting the errors

          Ulli Hafner added a comment - - edited

          Attached the parser definition that I'm using on my machine.

          Ulli Hafner added a comment - - edited Attached the parser definition that I'm using on my machine.

          Ulli Hafner added a comment -

          I tried to reproduce your problem without success: I created the parser and a new job that parses your console-log.txt as a file (2 warnings found) and the plain error message in the console log (1 warning found). Seems something wrong in your setup. Which warnings and Jenkins version are you using? Is the content of the WarningsPublisher.xml file the same?

          Can you try a new job with the following build command (shell script)?

          echo "19:35:11 err: Could not parse for environment production: Syntax error at '{'; expected '}' at /home/build/jenkins/workspace/puppet-parser-try/modules/profile/manifests/mongodb/abc/shard/master.pp:5"
          
          

          Ulli Hafner added a comment - I tried to reproduce your problem without success: I created the parser and a new job that parses your console-log.txt as a file (2 warnings found) and the plain error message in the console log (1 warning found). Seems something wrong in your setup. Which warnings and Jenkins version are you using? Is the content of the WarningsPublisher.xml file the same? Can you try a new job with the following build command (shell script)? echo "19:35:11 err: Could not parse for environment production: Syntax error at '{'; expected '}' at /home/build/jenkins/workspace/puppet-parser-try/modules/profile/manifests/mongodb/abc/shard/master.pp:5"

          Maneesh M P added a comment -

          I am using hte jenkins version 1.509.3 and warnings plug-in 4.35.
          By placing the above line inside a script, the warning correctly detected the error and showed the error as well. Why is it not detected
          Where will it be going wrong then ?

          Maneesh M P added a comment - I am using hte jenkins version 1.509.3 and warnings plug-in 4.35. By placing the above line inside a script, the warning correctly detected the error and showed the error as well. Why is it not detected Where will it be going wrong then ?

          Ulli Hafner added a comment - - edited

          Can you check what happens if your regexp is:

          ^(err:) (.*)at(.*\.pp):(\d+)$
          

          I think somehow the timestamp interferes...

          Or even simpler:

          (err:) (.*)at(.*\.pp):(\d+)
          

          Ulli Hafner added a comment - - edited Can you check what happens if your regexp is: ^(err:) (.*)at(.*\.pp):(\d+)$ I think somehow the timestamp interferes... Or even simpler: (err:) (.*)at(.*\.pp):(\d+)

          Maneesh M P added a comment -

          wow!! super, (err (.)at(.\.pp)\d+) did the trick I guess. That did indeed detect the errors. I am not sure what is the explanation for other regexp not working, but this one is working.

          Thanks,
          Maneesh

          Maneesh M P added a comment - wow!! super, (err (. )at(. \.pp) \d+) did the trick I guess. That did indeed detect the errors. I am not sure what is the explanation for other regexp not working, but this one is working. Thanks, Maneesh

            drulli Ulli Hafner
            maneeshmp Maneesh M P
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: