Does the script execution fail with an error? Do you see something in the log? Which version of jenkins/groovy are you running? I have a similar snippet running properly on my machines.
Ingo -- San Francisco Blog <http://8880km.blogspot.com> "today is tomorrows past blog" <http://ingorichter.blogspot.com> LinkedIn Profile: <http://www.linkedin.com/in/ingorichter> twitter: <http://twitter.com/ingorichter> On Mon, Aug 13, 2012 at 10:24 AM, krishna chaitanya kurnala < kkc...@gmail.com> wrote: > Hello All > > Just want to know, if there is a way, to mark a jenkins build as unstable > based on Sonar Analysis results. > > I tried to use sonar build breaker plugin( > http://docs.codehaus.org/display/SONAR/Build+Breaker+Plugin) , to analyse > sonar results and mark a build as Failure. I then tried to then change the > status of Build to Un-stable with Groovy Post Build Plugin, here is the > groovy snippet: > if(manager.logContains(".*Build Step SONAR marked Build as FAILURE.*")) { > manager.createSummary("warning.gif").appendText("<h1>You have been > warned!</h1>", false, false, false, "red") > manager.buildUnstable() > } > > But, the above script is failing to change status of build. Please help. > If possible. > > Thanks, > Krishna Chaitanya >