Repos without a recent commit are flagged as Invalid
Summary
When mirroring a project to a new Geo instance if there has been no commits in the last two years the project is marked as invalid.
Steps to reproduce
Add a new Geo node with repositories that have not had any commits within the last two years.
Example Project
I sent @dbalexandre a copy of one of the customer's repo's. I didn't include it because it's customer code.
What is the current bug behavior?
It fails with the error:
Synchronization failed - Invalid repository: 5:GetRepoPath: not a git repository '/gitlab-data/@hashed/c7/5d/c75d3f1f5bcd6914d0331ce5ec17c0db8f2070a2d4285f8e3ff11c6ca19168ff.git'
What is the expected correct behavior?
It should sync old projects
Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)
Possible fixes
In the short term, @dbalexandre was able to mark the problem repo's with the code below and Geo was able to sync them after. Project ID needs to be changed to the project in question.
project = Project.find(1435)
project.ensure_repository
project.repository.exists?
registry = Geo::ProjectRegistry.find_by(project_id: 1435)
registry.flag_repository_for_resync!
registry.update(last_repository_sync_failure: nil, force_to_redownload_repository: false)
registry.reload