Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for pagination issues in GitLab list repositories #41

Merged
merged 6 commits into from
Apr 7, 2022

Conversation

gineshkumar
Copy link
Contributor

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • I used go fmt ./... for formatting the code before submitting the pull request.
  • This feature is included on all supported VCS providers - GitHub, Bitbucket cloud, Bitbucket server, and GitLab.

Issue Description-

Gitlab List Repositories do not iterate through all the pages in the remote repository. This is because the "X-Total-Pages" are not populated by the remote API, which the library uses to decide whether to continue iteration or not.

Library requests for all projects the current user have visibility; this is similar to browsing "Explore Projects" (https://gitlab.com/explore/projects) in Gitlab. For performance reasons, if a query returns more than 10,000 records, GitLab doesn’t return the following headers:

"X-Total-Pages" is available if you request "membership=true" projects; these are the projects where the current user is a member.

Fix -

  • vcsclient/gitlab.go - added membership=true to the request URI.

  • vcsclient/gitlab_test.go - Updated the test case, to mock pagination.

  • vcsclient/testdata/gitlab/projects_response.json - Added more data to return two pages, with a default page size of 20.

Copy link
Member

@yahavi yahavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this important bug fix, @gineshkumar!

@yahavi yahavi merged commit 5272706 into jfrog:master Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants