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

paginate Gitea repository list #64

Closed
bradrydzewski opened this issue Jun 10, 2020 · 6 comments · Fixed by #66
Closed

paginate Gitea repository list #64

bradrydzewski opened this issue Jun 10, 2020 · 6 comments · Fixed by #66

Comments

@bradrydzewski
Copy link
Member

bradrydzewski commented Jun 10, 2020

Gitea implemented pagination for the repository list which results in only 10 repositories being returned. We have mechanisms in place for handling pagination. Here is a note from our Discourse forum:

Pagination would need to be added to the code here:
https://github.com/drone/go-scm/blob/master/scm/driver/gitea/repo.go#L42

For reference you can see how we do this with GitHub:
https://github.com/drone/go-scm/blob/master/scm/river/github/repo.go#L85

Some additional code may be required to extract the pagination data from the response (i.e. current page, next page, last page, results per page). However, if Gitea uses the same approach as GitHub (example below) than this would not require any additional code.

Link: <https://api.github.com/user/repos?page=3&per_page=100>; rel="next",
 <https://api.github.com/user/repos?page=50&per_page=100>; rel="last"

Source: https://discourse.drone.io/t/drone-only-shows-10-repositories-from-gitea/6922/16

@ryanjaeb
Copy link

There's a Gitea PR that says it fixed this to work without any Drone changes. I don't have 10+ repos to test it easily, but, for anyone that was having a problem, the linux-amd64 Docker image looks like it already includes the changes (org.label-schema.vcs-ref=48842ed1).

@xf-
Copy link

xf- commented Jun 18, 2020

@bradrydzewski paging in frontend has a limit parameter - couldn't you increase it to 1000?

e.g.
https://gitserver/api/v1/repos/search?sort=updated&order=desc&uid=1&q=&page=1&limit=1000&mode=&archived=false

@moepman
Copy link

moepman commented Jun 19, 2020

I think it is still broken with Gitea 1.12.0 - see go-gitea/gitea#11970

@lafriks
Copy link

lafriks commented Jun 19, 2020

Just tested on try.gitea.io and it does seem to return needed header:

content-length: 2484
content-type: application/json; charset=UTF-8
date: Fri19 Jun 2020 10:25:04 GMT
link: <https://try.gitea.io/api/v1/user/repos?access_token=xxx&limit=2&page=2>; rel="next",<https://try.gitea.io/api/v1/user/repos?access_token=xxx&limit=2&page=5>; rel="last"
x-content-type-options: nosniff
x-firefox-spdy: h2
x-frame-options: SAMEORIGIN
x-total-count: 9 

@lafriks
Copy link

lafriks commented Jun 19, 2020

@bradrydzewski If there anything needs to be fixed on gitea side please let me know

@moepman
Copy link

moepman commented Jun 19, 2020

@lafriks

Just tested on try.gitea.io and it does seem to return needed header:

content-length: 2484
content-type: application/json; charset=UTF-8
date: Fri19 Jun 2020 10:25:04 GMT
link: <https://try.gitea.io/api/v1/user/repos?access_token=xxx&limit=2&page=2>; rel="next",<https://try.gitea.io/api/v1/user/repos?access_token=xxx&limit=2&page=5>; rel="last"
x-content-type-options: nosniff
x-firefox-spdy: h2
x-frame-options: SAMEORIGIN
x-total-count: 9 

I think the effect will only be there if you have more than 30 repositories, see my gitea issue for more Details. But yes I think the problem I reported needs fixing on the drone.io side.

jstrachan pushed a commit to jstrachan/go-scm that referenced this issue Dec 22, 2020
fix: add Christie and Billy to the owners file
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 a pull request may close this issue.

5 participants