how to bulk delete previous builds

21 views
Skip to first unread message

tvaughan

unread,
May 27, 2010, 10:40:58 PM5/27/10
to Bitten
What would the proper SQL voodoo be to delete all previous builds?
There was a bit of a screw up with the setup on the build slaves, and
I'd like to simply trigger a full rebuild without having to redo
anything else. Thanks.

-Tom

osimons

unread,
May 27, 2010, 11:00:29 PM5/27/10
to Bitten
You also need to delete the log files on disk + step information, and
possibly any attachments. I'd prefer if the Python API was used - that
should take care of all the details:

>>> from trac.env import Environment
>>> myenv = Environment('/path/to/trac/project')
>>> from bitten.model import Build
>>> for build in Build.select(myenv): build.delete()

To see that a build is deleted as you hope it will be, you can also
delete individual builds by changing the last batch line into fetching
a single build (replace build id) and deleting it:

>>> Build.fetch(myenv, 344).delete()

And, as always: Backup your database - and for Bitten also the log/
bitten directory inside the project where build logs are kept.


:::simon

https://www.coderesort.com
http://www.ohloh.net/accounts/osimons



Tom Vaughan

unread,
May 27, 2010, 11:44:17 PM5/27/10
to bit...@googlegroups.com
On Thu, May 27, 2010 at 20:00, osimons <odds...@gmail.com> wrote:
> On May 28, 4:40 am, tvaughan <thomas.david.vaug...@gmail.com> wrote:
>> What would the proper SQL voodoo be to delete all previous builds?
>> There was a bit of a screw up with the setup on the build slaves, and
>> I'd like to simply trigger a full rebuild without having to redo
>> anything else. Thanks.
>
> You also need to delete the log files on disk + step information, and
> possibly any attachments. I'd prefer if the Python API was used - that
> should take care of all the details:
>
>>>> from trac.env import Environment
>>>> myenv = Environment('/path/to/trac/project')
>>>> from bitten.model import Build
>>>> for build in Build.select(myenv): build.delete()
>
> To see that a build is deleted as you hope it will be, you can also
> delete individual builds by changing the last batch line into fetching
> a single build (replace build id) and deleting it:
>
>>>> Build.fetch(myenv, 344).delete()

Perfect. Exactly what I needed. Thanks!

-Tom


>
> And, as always: Backup your database - and for Bitten also the log/
> bitten directory inside the project where build logs are kept.
>
>
> :::simon
>
> https://www.coderesort.com
> http://www.ohloh.net/accounts/osimons
>
>
>

> --
> You received this message because you are subscribed to the Google Groups "Bitten" group.
> To post to this group, send email to bit...@googlegroups.com.
> To unsubscribe from this group, send email to bitten+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/bitten?hl=en.
>
>

--
http://flavors.me/tvaughan

Reply all
Reply to author
Forward
0 new messages