Set visibility level 'Private' for 'Internal' imported projects when 'Internal' visibility is restricted
Problem statement
With https://gitlab.com/gitlab-org/gitlab-ee/issues/12388 change going live restricting Internal
visibility level there is a potential risk of breaking Internal
project imports (due to this check https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/services/projects/create_service.rb#L24).
Proposed solution
If we are trying to import a project with 'Internal' visibility, but this option is disabled on the import instance, we should set the visibility level to 'Private'.
Additionally, investigate why when Internal
setting is restricted it is still possible to import GitLab Export
project that has Internal
setting, the project is still imported successfully, and Internal
setting is set on it, even though it is restricted.
Notes
After a bit of debugging it appears that this statement https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/services/projects/create_service.rb#L24 returns true
due to the fact that @project.visibility_level
returns 0
(which is private, even though it is 10
in the export). By the time the project is actually imported and saved it is updated to 10
.