An error occurred while fetching the assigned milestone of the selected merge_request.
Add feature to delete inactive projects
Compare changes
- Huzaifa Iftikhar authored
@@ -21,7 +21,7 @@ def perform
master
we can update the base branch to master
for this MR as well.master
.inactive_projects_delete_after_months
defined in the application_settings
table. In case the project is still inactive it permanently deletes the project.HTML version | Plain text |
---|---|
![]() |
![]() |
Instance audit events | Project audit events |
---|---|
![]() |
![]() |
![]() |
last_activity_at
of both the projects so that they are considered as inactive. For example:project = Project.find(<id of Project A>)
project.last_activity_at = 3.years.ago
project.save!
Feature.enable(:inactive_projects_deletion, Namespace.without_project_namespaces.find_by_full_path('<name of Group A>'))
https://gdk.test:3000/api/v4/application/settings?delete_inactive_projects=true&inactive_projects_send_warning_email_after_months=6&inactive_projects_delete_after_months=10&inactive_projects_min_size_mb=0
redis-cli -s <path-to-gitlab-development-kit>/redis/redis.socket
. Verify that redis hash is empty by running hgetall inactive_projects_deletion_warning_email_notified
inside the redis CLI.1_settings.rb
file and update the inactive_projects_deletion_cron_worker
cron timing to run every minute. This will help us test the feature fast. Restart the background jobs using gdk restart rails-background-jobs
Projects::InactiveProjectsDeletionCronWorker
to run. You can tail the logs gdk tail rails-background-jobs | grep -i inactive
.https://gdk.test:3000/rails/letter_opener/
and verify that we've received the deletion warning email for Project A. Also verify that no email should have been received for Project B (we didn't enable the feature flag for this project).hgetall inactive_projects_deletion_warning_email_notified
in redis-cli and verify that the key for project A exists. The value should be the current date which signifies the date when the deletion warning email was sent.inactive_projects_delete_after_months - inactive_projects_send_warning_email_after_months
) months ago (4 months as per our example). Run the following to update via redis-cli hset inactive_projects_deletion_warning_email_notified project:<project_if of Project A> 2021-04-25
Projects::InactiveProjectsDeletionCronWorker
to run again. This time the project should get deleted immediately or should get marked for deletion if the project had enabled delayed project deletion.hgetall inactive_projects_deletion_warning_email_notified
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/357376