Hi Krishna,
Here is the snippet that I'm using on one of the build machines:
if(manager.logContains("Could not login to FTP server")) {
manager.addWarningBadge("FTP Login Failure")
manager.createSummary("warning.gif").appendText("<h1>Failed to login to
remote FTP Server!</h1>", false, false, false, "red")
manager.buildUnstable()
}
This will be executed by a groovy postbuild step. I hope this will help,
even if my snippet doesn't look that much different than yours.
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 3:11 PM, krishna chaitanya kurnala <[email protected]
> wrote:
> Hello Ingo
>
> Thanks for your response. We are using Jenkins 1.474 and Groovy Post build
> version is 1.7
>
> Can you please share with me the snippet if possible.
>
> Another observation is that, if i disable sonar analysis in the job and
> give a diff string to mark un-stabilize the Build, the same snippet just
> works well.
>
> Thanks,
> Krishna Chaitanya
>
>
>
> On Mon, Aug 13, 2012 at 11:47 AM, Ingo Richter <[email protected]>wrote:
>
>> 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 <
>> [email protected]> 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
>>>
>>
>>
>