Quantcast

marking a build as un-stable with groovy post-build plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

marking a build as un-stable with groovy post-build plugin

krishna chaitanya kurnala
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: marking a build as un-stable with groovy post-build plugin

Ingo Richter
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
--


On Mon, Aug 13, 2012 at 10:24 AM, krishna chaitanya kurnala <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: marking a build as un-stable with groovy post-build plugin

krishna chaitanya kurnala
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 <[hidden email]> 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
--



On Mon, Aug 13, 2012 at 10:24 AM, krishna chaitanya kurnala <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: marking a build as un-stable with groovy post-build plugin

Ingo Richter
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
--


On Mon, Aug 13, 2012 at 3:11 PM, krishna chaitanya kurnala <[hidden email]> 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 <[hidden email]> 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
--



On Mon, Aug 13, 2012 at 10:24 AM, krishna chaitanya kurnala <[hidden email]> 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



Loading...