WIP: Fix gitlab import project load
What does this MR do?
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
Since 10.8 the GitLab import seems to be broken. In version 10.7 we were still using API version v3. The endpoint looked like:
get do
authenticate!
present_projects current_user.authorized_projects.order_id_desc,
with: ::API::V3::Entities::ProjectWithAccess
end
So, the list of projects was from the authorized projects the user has. Since version 10.8 we started using API version v4. The project endpoint is:
def load_projects
ProjectsFinder.new(current_user: current_user, params: project_finder_params).execute
end
get do
present_projects load_projects
end
In this case, the API is retrieving all projects the user has access (even public ones) unless the params membership is enabled. So, right now, when we try to import a project, it first retrieves all user project + all public ones, because we are not using the membership option. And the request times out.
Some of the improvements are:
-
Enable membershipparam -
Enable simpleparam to reduce the length of each request to the API -
Add MAX_PAGEparam to stop making request after a number of pages
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Conform by the code review guidelines
-
Has been reviewed by a UX Designer -
Has been reviewed by a Frontend maintainer -
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Conform by the database guides -
If you have multiple commits, please combine them into a few logically organized commits by squashing them -
Internationalization required/considered -
End-to-end tests pass ( package-and-qamanual pipeline job)
What are the relevant issue numbers?
Fixes #48123 (closed)
Edited by Francisco Javier López