API Support for Immediate Group Deletion
Release Notes
TBD
Problem to Solve
Users can mark an individual group for immediate deletion via group settings in the UI, but this option is currently not supported via API.
One use case that this poses a problem for is for QA tests and test data cleanup. Our cleanup scripts currently make use of DELETE /groups/:id
, but this only “soft” deletes a group and marks it pending for deletion.
We are then left with large amounts of groups still left over and affecting the performance of our test suite (for example, see gitlab-qa-sandbox-group
in production, which now has over 6,000 subgroups).
- This can cause instability and intermittent failures due to query timeouts, such as Intermittent Failure in browser_ui/1_manage/gro... (#358213 - closed).
- It is also not a realistic representation of a group hierarchy size we would find for our customers in production (see this comment as an example of what the distribution of hierarchy sizes in production looks like).
There have been efforts in the past to create a Sidekiq cron job for immediately deleting QA groups, but that had its own risks involved and ultimately had to be reverted.
Proposal
Support the option to immediately remove a subgroup via API
- Please add this feature behind a feature flag
- Pass an optional parameter to
DELETE /groups/:id
, such aspermanently_remove
, that when set totrue
, will remove the subgroup immediately only if already previously marked for deletion- This parameter should be coupled with an additional, required parameter
full_path
that accepts the subgroup's full path (which includes its parent group(s), ex:parent-group/subgroup
), similar to the confirmation that is required on the UI.
- This parameter should be coupled with an additional, required parameter
- Request should fail if user authorized has a role lower than Owner
- Only subgroups should be allowed to be permanently deleted with this feature. Top-level groups should continue to only be immediately deleted via the UI due to their significance, as they often represent an entire instance for our enterprise customers
(See https://docs.gitlab.com/ee/user/group/#remove-a-group-immediately)
Notes
- Feature flag:
- Name: immediate_delete_subgroup_api
- Default value: false
- Will be enabled on top level group.
- Introduced in MR: !92508 (merged)