Skip to content

Fix gitlab import project load

What does this MR do?

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 membership param
  • Enable simple param to reduce the length of each request to the API
  • Add pagination params to each Gitlab::GitlabImport::Client call

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Fixes #48123 (closed)

Merge request reports