Project Importers do not show any import errors if there are any
Currently when importing a project to GitLab using any of the importers (GitHub/Gitea/etc) if the error occurs it gets rescued and saved to errors
array as a way to do graceful failure, instead of failing hard. Then project.import_state.last_error
gets updated with that value.
For example, gitea importer: https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/legacy_github_import/importer.rb#L133-134
However, while testing this behaviour I noticed 2 issues:
- These errors are not shown in any way to the user. Importing page just indicates that the import is complete and there is no way for a user to know that something was not imported.
-
import_state.last_error
gets update to nil when import is complete, so any of the errors that might have occurred during the import get wiped out. This is due to the change that has been added 2 years ago !2628 (diffs) (I am sure there has been a good reason for that). But this removes any traces of records that failed to be imported and it looks as if there were no errors during import.
If I remove last_error: nil
bit and redo import there are no indications to the user of any failures except a record in the database.
The project import is indeed completed but some of the things are missing. It could be that certain repo features (like issues, pull requests) are disabled, but also because something went wrong during the record creation.
So I am wondering if:
- We should display these errors that happened during import to the user?
- We should investigate reasons behind setting
last_error: nil
on finish, as this step hides any problems that occurred during import.