Automatically backup project before deletion
Problem to solve
Currently when a project is deleted, it is queued for deletion immediately. We should consider creating a backup before deletion to ensure there is a way forward if the project was deleted by mistake like what happened in https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7957.
Intended users
All users would benefit from this feature.
Further details
This feature would make it easier to recover from an accidental deletion of a project. It would reduce anxiety in the deletion process and give GitLab.com users a way to recover from accidental deletions on their own with no outside assistance needed. This feature would be ON by default with an option to disable.
Proposal
Upon requesting the deletion of a project, GitLab would use the export feature to generate a backup and email the user issuing the delete with the link to download the export, just as if the user had clicked the export button. Then, if the backup succeeds it will proceed onward to deletion. If the backup fails, it will abort the delete as well.
Permissions and Security
No new permissions would be required as this would be based off the permission to delete. If you have permission to delete the project, you would also have permission to export anyway.
Testing
This would follow existing workflows and thus additional tests would need to be able to measure whether a backup would successfully be created before a deletion.
What does success look like, and how can we measure that?
Does a backup get created before deletion? Success!
What is the type of buyer?
All users would benefit this and thus it should go into Core
Links / references
- Accidental deletion of gitlab-org/GitLab https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/7957
- gitlab-com/gl-infra/production#1183 (closed)