• Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • log-parser-plugin
    • None

      Jenkins 1.651.3
      Log Parser Plugin 2.0
      Pipeline 2.4

      Log parser plugin does not throw an exception after detecting errors in console output.
      The plugin fails the build but there is no way to know in runtime if it was failed.
       

      try {
          step([$class: 'LogParserPublisher', 
              failBuildOnError: true, 
              parsingRulesPath: 'blabla.txt', 
              showGraphs: true, 
              unstableOnWarning: true, 
              useProjectRule: false])
      } catch(e) {
          echo 'Check console output for errors.'
      } finally {
          echo 'finally'
      }
      

      So the output 'Check console output for errors.' is not seen. At the same time 'finally' block is executed and output is seen in console log.

          [JENKINS-43765] No way to check results of Log Parser Plugin

          Did you try echoing currentBuild.result before and after the parser step?

          Generic Ratslaugh added a comment - Did you try echoing currentBuild.result before and after the parser step?

          generatz,  thank you, such approach works.

           

          currentBuild.result = 'SUCCESS'

          step([$class: 'LogParserPublisher', failBuildOnError: true, parsingRulesPath: 'blabla.txt', showGraphs: true, unstableOnWarning: true, useProjectRule: false])

          if ('FAILURE' == currentBuild.result) { throw "Error" }

          Kirill Fedoseev added a comment - generatz ,  thank you, such approach works.   currentBuild.result = 'SUCCESS' step( [$class: 'LogParserPublisher', failBuildOnError: true, parsingRulesPath: 'blabla.txt', showGraphs: true, unstableOnWarning: true, useProjectRule: false] ) if ('FAILURE' == currentBuild.result) { throw "Error" }

          ahmed daniel added a comment -

          This doesnt work if failBuildOnError is set to false. I dont want to fail my build on error but want to know the result of log parsing. How can I do that?

          ahmed daniel added a comment - This doesnt work if failBuildOnError is set to false. I dont want to fail my build on error but want to know the result of log parsing. How can I do that?

          still an issue in version 2.1?

          Martin Reinhardt added a comment - still an issue in version 2.1?

            zalimgandhera ahmed daniel
            krlf Kirill Fedoseev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: