Hey Jdhein,

can u pls provide me whole groovy code what u r using for ur project.
because i am also facing same problem.



On Saturday, October 8, 2011 at 4:28:50 AM UTC+5:30, jdhein wrote:
>
>
>
> On Oct 7, 4:11 am, Christopher Orr <[email protected]> wrote: 
> > On 06/10/11 21:19, jdhein wrote: 
> > 
> > > My organization has just tons of projects in Jenkins, many of which 
> > > are not active and have not built in some time, some of them haven't 
> > > built in over 17 months. I have gone through and turned on "discard 
> > > old builds" with a max of 10 builds. However, it has been weeks since 
> > > changing this setting and Jenkins has not deleted the excess builds. I 
> > > am guessing I have to poke the bear by kicking off a build... only, I 
> > > don't want to do this for projects I am not directly involved with. 
> > 
> > > Is there a way to tell Jenkins to go ahead and discard the old builds 
> > > right now? 
> > 
> > You can use the Script Console to fetch the jobs you want, and then call 
> > logRotate() on each of them. 
> > 
> > Probably something like this should work, not that I've tested it: 
> > 
> > for(job in Hudson.instance.items) { 
> >    job.logRotate() 
> > 
> > } 
> > 
> > Take a look at the examples on the wiki for more info, and if you come 
> > up with something good, you can add it to the list:
> https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console 
> > 
> > Regards, 
> > Chris 
>
> Thanks, the groovy script you gave me worked like a champ with the 
> only change I made being to add an import: 
>
> import hudson.model.* 
> for(job in Hudson.instance.items) { 
>    job.logRotate() 
> } 
>
> Honestly, without the groovy script you gave me I would not have been 
> able to come up with this without investing a bunch of time 
> researching how Jenkins works and how to write groovy scripts. So 
> thanks a bunch!

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/808240be-de1e-4c0a-a5f5-aebcdf9328c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to