This worked for me except for one thing.  In a multi-module Maven project 
the child modules still have all their builds on the filesystem, even 
though they are gone in the UI.

On Friday, October 7, 2011 6:58:50 PM UTC-4, 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].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to