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

strage behavior of manager.logContains() API in Groovy Post Build plugin

XMLWordPrintable

      Hi,

       

      Trying to use Groovy Post build plugin in order to parse build output log in reverse order. 

      manager.logContains seems not to be suitable for my since it always parse the log from the begging and I am using a variable in my scripted pipeline as a matcher which needs to be updated with latest value found in the console output. This seems not to be happening. 

      The scenario is: in the same build log I have several text lines like: Failed: *. In case I find Failed: 0, I do something, in case of Failed: anything but 0, I do something else. 

      Using: 

      if(manager.logContains(".Failed: 0.")) {if(manager.logContains(".Failed: 0.")) {     println "No failure"     println "+++++ ${manager.logContains(".Failed: 0.")}" } else if(matcher?.matches()){            echo 'Matches!!'                buildMsg=matcher.group(1).toInteger()            if ((buildMsg - failure)> 0)

      {           println 'There are tests failed!'        //   manager.buildUnstable()          throw new RuntimeException("Failed")           }

          }

      this does not work properly. Can you please help to solve this?

       

      Thank you!

            wolfs Stefan Wolf
            geanina Geanina Sz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: