Skip to content

Instantly share code, notes, and snippets.

@yorammi
Last active April 23, 2019 20:58
Show Gist options
  • Save yorammi/82cfc034ec12218cede4 to your computer and use it in GitHub Desktop.
Save yorammi/82cfc034ec12218cede4 to your computer and use it in GitHub Desktop.
Groovy PostBuild step code for changing the job build status if certain text appear in the build log ourput
errpattern = ~/TEXT-TO-LOOK-FOR-IN-JENKINS-BUILD-OUTPUT.*/;
manager.build.logFile.eachLine{ line ->
errmatcher=errpattern.matcher(line)
if (errmatcher.find()) {
manager.build.@result = hudson.model.Result.NEW-STATUS-TO-SET
}
}
@ellykelly112358
Copy link

Hi Yorammi,
I got this error:

Caught: groovy.lang.MissingPropertyException: No such property: manager for class: hudson7849208122012374233
groovy.lang.MissingPropertyException: No such property: manager for class: hudson7849208122012374233
    at hudson7849208122012374233.run(hudson7849208122012374233.groovy:2)

Any ideas?
Thanks

@nareshg4
Copy link

nareshg4 commented Nov 3, 2017

got the same error.... any idea on how to solve it??

@amitbhadra
Copy link

He's using the groovy post build plugin. There manager is predefined for you and you can use it directly.

@duncwa
Copy link

duncwa commented Apr 23, 2019

I am getting this same error and have yet to resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment