Repositories with Remote Mirror cannot be deleted
Summary
ZD Reference https://gitlab.zendesk.com/agent/tickets/33703
Project is never deleted. Folder remains in the filesystem and the database row is still there in the Projects table, with the
pending_delete
column set totrue
. The project is not visible anymore in the UI, though. It is not possible to recreate a project with the same name (error message "Name has already been taken, Path has already been taken") Sidekiq log shows errors like this:
2016-08-08T09:58:59.542Z 23228 TID-1j0qok WARN: {"class":"ProjectDestroyWorker","args":[10147,2966,{}],"retry":true,"queue":"default","did":"eddcd5ee0bcad694ddfdaa65","created_at":1470649600.0374076,"enqueued_at":1470650339.2107358,"error_message":"undefined method `repository' for nil:NilClass","error_class":"NoMethodError","failed_at":1470649600.8157573,"retry_count":5,"retried_at":1470650339.5416071}
Trying to execute ::Projects::DestroyService from the rails console we see the source of the error:
NoMethodError: undefined method `repository' for nil:NilClass
from /var/lib/git/gitlab/app/models/remote_mirror.rb:161:in `remove_remote'
Steps to reproduce
- Create
project-a
andproject-b
- Commit something on
project-a
& push it - Configure
project-a
to push to remote mirror toproject-b
- Remove
project-a
- Create
project-a
Expected behavior
project-a
gets created
Actual behavior
project-a
never got deleted, trying to create it returns Name has already been taken
Relevant logs and/or screenshots
REPRODUCED ON GITLAB.COM
- Original Project: https://gitlab.com/cabargas/member-hook
- Mirrored Project: https://gitlab.com/cabargas/testing-mirroring
- Removed original project
- Trying to create it again throws error