@@ -94,19 +94,23 @@ def reset_gitlab(gl: gitlab.Gitlab) -> None:
94
94
helpers .safe_delete (deploy_token )
95
95
logging .info (f"Deleting project: { project .path_with_namespace !r} " )
96
96
helpers .safe_delete (project )
97
-
97
+
98
98
full_paths = [group .full_path for group in gl .groups .list ()]
99
99
logging .info (f"Groups to be deleted: { full_paths } " )
100
100
for group in gl .groups .list ():
101
101
logging .info (f"Current group: { group .full_path !r} , group_id: { group .get_id ()} " )
102
- for deploy_token in group .deploytokens .list ():
103
- logging .info (
104
- f"Deleting deploy token: { deploy_token .username !r} in "
105
- f"group: { group .path_with_namespace !r} "
106
- )
107
- helpers .safe_delete (deploy_token )
108
- logging .info (f"Deleting group: { group .full_path !r} " )
109
- helpers .safe_delete (group )
102
+ descendant_full_paths = [group .full_path for group in group .descendant_groups .list (order_by = "id" , sort = "desc" )]
103
+ logging .info (f"Descendant groups to be deleted: { descendant_full_paths } " )
104
+ for descendant_group in group .descendant_groups .list (order_by = "id" , sort = "desc" ):
105
+ logging .info (f"Current group: { descendant_group .full_path !r} , group_id: { descendant_group .get_id ()} " )
106
+ for deploy_token in group .deploytokens .list ():
107
+ logging .info (
108
+ f"Deleting deploy token: { deploy_token .username !r} in "
109
+ f"group: { group .path_with_namespace !r} "
110
+ )
111
+ helpers .safe_delete (deploy_token )
112
+ logging .info (f"Deleting group: { group .full_path !r} " )
113
+ helpers .safe_delete (group )
110
114
for topic in gl .topics .list ():
111
115
logging .info (f"Deleting topic: { topic .name !r} " )
112
116
helpers .safe_delete (topic )
0 commit comments