Quick Groovy script to delete Job builds

Eyal Edri eedri at redhat.com
Sat Mar 19 17:16:09 UTC 2016


Yea, its located here: http://jenkins.ovirt.org/scriptler/
I see you already added it :)

I've sent a patch to specify this option, as it might contain useful
commands:
https://gerrit.ovirt.org/#/c/54955/

e.



On Thu, Mar 17, 2016 at 12:40 PM, David Caro <dcaro at redhat.com> wrote:

> On 03/17 14:38, Barak Korren wrote:
> > Hi there,
> >
> >
> > Working on cleaning up Jenkins I came up with the following Groovy
> script:
> >
> >   job_name = 'ovirt-engine_3.6_build-artifacts-fc22-x86_64'
> >   successful_to_keep = 5
> >
> >   job = Hudson.instance.getJob(job_name)
> >
> >   recent_success_times =
> >     job._getRuns().
> >     findAll({k, v -> v.result == Result.SUCCESS }).
> >     collect([], { k, v -> v.time }).
> >     sort().reverse().take(successful_to_keep)
> >
> >   third_success = recent_success_times.last()
> >
> >   job._getRuns().
> >     findAll({ k, v -> v.time < third_success }).
> >     each({ k, v -> v.delete() })
> >
> > The script deletes all builds older then the 5th last successful build.
>
>
> There's a plugin installed called 'scriptler' that allows you to put those
> groovy scripts there, there are already a couple iirc
>
> >
> > --
> > Barak Korren
> > bkorren at redhat.com
> > RHEV-CI Team
> > _______________________________________________
> > Infra mailing list
> > Infra at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/infra
>
> --
> David Caro
>
> Red Hat S.L.
> Continuous Integration Engineer - EMEA ENG Virtualization R&D
>
> Tel.: +420 532 294 605
> Email: dcaro at redhat.com
> IRC: dcaro|dcaroest@{freenode|oftc|redhat}
> Web: www.redhat.com
> RHT Global #: 82-62605
>
> _______________________________________________
> Infra mailing list
> Infra at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/infra
>
>


-- 
Eyal Edri
Associate Manager
RHEV DevOps
EMEA ENG Virtualization R&D
Red Hat Israel

phone: +972-9-7692018
irc: eedri (on #tlv #rhev-dev #rhev-integ)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/infra/attachments/20160319/158cd1b9/attachment.html>


More information about the Infra mailing list