
--Md/poaVZ8hnGTzuv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 03/17 14:38, Barak Korren wrote:
Hi there, =20 =20 Working on cleaning up Jenkins I came up with the following Groovy script: =20 job_name =3D 'ovirt-engine_3.6_build-artifacts-fc22-x86_64' successful_to_keep =3D 5 =20 job =3D Hudson.instance.getJob(job_name) =20 recent_success_times =3D job._getRuns(). findAll({k, v -> v.result =3D=3D Result.SUCCESS }). collect([], { k, v -> v.time }). sort().reverse().take(successful_to_keep) =20 third_success =3D recent_success_times.last() =20 job._getRuns(). findAll({ k, v -> v.time < third_success }). each({ k, v -> v.delete() }) =20 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
=20 --=20 Barak Korren bkorren@redhat.com RHEV-CI Team _______________________________________________ Infra mailing list Infra@ovirt.org http://lists.ovirt.org/mailman/listinfo/infra
--=20 David Caro Red Hat S.L. Continuous Integration Engineer - EMEA ENG Virtualization R&D Tel.: +420 532 294 605 Email: dcaro@redhat.com IRC: dcaro|dcaroest@{freenode|oftc|redhat} Web: www.redhat.com RHT Global #: 82-62605 --Md/poaVZ8hnGTzuv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJW6qW9AAoJEEBxx+HSYmnDy7cH/0HWvrFaJI22+vch6YpOKYTd YLUkNUJKNMB9aTeM1pSRv+dMjGtlyaBDXunZmiy/g3iaSEnUzmirCvhO+EUFhCaU 9JgZVkpd8VngsSuL9/xkc6BG8X3Hhq7K/aJp+99szUYLPInu4Vo1AlCScxDemESy 9I5Phco8cqLMGQJuaQhWN0gtYT9YtZ/4C+MgSY9mUJzFA6u+jv7t1LYFAboEYbkj Ud9P/YRVMY+JFgdqD+A18RfYBlst2qv5gkJhpbISa4vaTl4qYGST4Waxea3rAMSd ZGQC7zFrT/RyHiDx5djkIyLacyJmLB3iXmwO3dQ399nBiuzdrggE6y/9FGdD2Ww= =/g2k -----END PGP SIGNATURE----- --Md/poaVZ8hnGTzuv--