where can I find the code that deletes builds?

36 views
Skip to first unread message

Chris Withers

unread,
Feb 5, 2013, 5:51:14 AM2/5/13
to jenkin...@googlegroups.com
Hi All,

Trying to do some debugging for this issue:

https://issues.jenkins-ci.org/browse/JENKINS-16638

Where would I look in a clone of the jenkins repo to find the code that
deletes old builds? (since that's my only guess as to what could have
deleted these child builds...)

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Daniel PETISME

unread,
Feb 5, 2013, 8:43:41 AM2/5/13
to jenkin...@googlegroups.com
i've got 2 snippets you can use.

The first one assume that you have access at the Groovy console. It will delete all the old builds of a job and reset the buildNumber:
def job = hudson.model.Hudson.instance.items.find{ it.name == "<JOB_NAME>"}
job.getBuilds().each{ it.delete()}
job.updateNextBuildNumber(1)

The second snippet delete the job itself (you've to check about the filesystem cleaning). Each "Item" as a delete method
Have a look at: https://github.com/jenkinsci/rrod-plugin/blob/master/src/main/java/com/michelin/cio/jenkins/plugin/rrod/model/DeleteRequest.java
The RROD plugin aims to force user to ask to the Jenkins admin to rename or delete a job.
https://wiki.jenkins-ci.org/display/JENKINS/Request+Rename+Or+Delete+Plugin

Let me know if you succeed to do it.

Regards

Daniel

Daniel Olausson

unread,
Feb 5, 2013, 8:46:53 AM2/5/13
to jenkin...@googlegroups.com
You can also look here:

Hudson.model.Run Line 1242:

 public synchronized void delete()

Chris Withers

unread,
Feb 5, 2013, 8:55:26 AM2/5/13
to jenkin...@googlegroups.com, Daniel PETISME
Hi Daniel,

I'm afraid this isn't what I'm after.
A whole bunch of builds in one of my matrix jobs vanished from the file
system this morning.

I'm trying to find out why, rather than deleting anything more!

cheers,

Chris

On 05/02/2013 13:43, Daniel PETISME wrote:
> i've got 2 snippets you can use.
>
> The first one assume that you have access at the Groovy console. It will
> delete all the old builds of a job and reset the buildNumber:
>
> def job = hudson.model.Hudson.instance.items.find{ it.name =="<JOB_NAME>"}
> job.getBuilds().each{ it.delete()}
> job.updateNextBuildNumber(1)
>
>
> The second snippet delete the job itself (you've to check about the filesystem cleaning). Each "Item" as a delete method
>
> Have a look at:https://github.com/jenkinsci/rrod-plugin/blob/master/src/main/java/com/michelin/cio/jenkins/plugin/rrod/model/DeleteRequest.java
>
> The RROD plugin aims to force user to ask to the Jenkins admin to rename or delete a job.
>
> https://wiki.jenkins-ci.org/display/JENKINS/Request+Rename+Or+Delete+Plugin
>
>
> Let me know if yousucceed to do it.
>
>
> Regards
>
>
> Daniel
>
>
>
> On Tuesday, February 5, 2013 11:51:14 AM UTC+1, Chris Withers wrote:
>
> Hi All,
>
> Trying to do some debugging for this issue:
>
> https://issues.jenkins-ci.org/browse/JENKINS-16638
> <https://issues.jenkins-ci.org/browse/JENKINS-16638>
>
> Where would I look in a clone of the jenkins repo to find the code that
> deletes old builds? (since that's my only guess as to what could have
> deleted these child builds...)
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
> - http://www.simplistix.co.uk
>
> --
> You received this message because you are subscribed to the Google
> Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jenkinsci-de...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________

Chris Withers

unread,
Feb 5, 2013, 1:51:39 PM2/5/13
to jenkin...@googlegroups.com, Daniel Olausson
On 05/02/2013 13:46, Daniel Olausson wrote:
> You can also look here:
>
> Hudson.model.Run Line 1242:
>
> public synchronized void delete()

Got it, however can't see what loggers I could configure to capture when
files are deleted.

I guess I also can't follow where/how this would be called to delete the
child builds of a matrix config while leaving the parent builds in
place, but that's because I don't speak Java, which is a shame...
Reply all
Reply to author
Forward
0 new messages