NixOS / hydra

Hydra, the Nix-based continuous build system
http://nixos.org/hydra
GNU General Public License v3.0
1.1k stars 291 forks source link

Delete generated jobsets that are no longer tracked/generated by `.jobsets` #1326

Open basile-henry opened 6 months ago

basile-henry commented 6 months ago

Is your feature request related to a problem? Please describe. We have a setup where we generate jobsets for each PR. When a PR is closed/merged, the associated jobset is no longer generated by .jobsets so it is disabled and set to hidden automatically by hydra: https://github.com/NixOS/hydra/blob/411e4d0c2458ec5319b8ea88129dff807793f7d7/src/lib/Hydra/Helper/AddBuilds.pm#L114

The issue is that it prevents hydra from garbage collecting any associated build products. This went unnoticed for us for years and is holding on to terabytes worth of useless build products :sweat_smile:

Describe the solution you'd like I understand that deleting jobsets (even disabled/hidden ones) can be problematic (see #1006 and #963). So as an intermediate solution, until these other issues are resolved, I would like to still be able to delete it manually (curl -X DELETE) with the jobset_DELETE endpoint. At the moment no generated jobsets can be deleted: https://github.com/NixOS/hydra/blob/411e4d0c2458ec5319b8ea88129dff807793f7d7/src/lib/Hydra/Controller/Jobset.pm#L99-L101 Maybe this check could be loosened to allow deleting jobsets that are already disabled and hidden anyway? Or is there some other reason for disallowing modifying generated jobsets I have not considered?

Describe alternatives you've considered Buying more HDDs :sweat_smile: