Drone

Drone only shows 10 repositories from Gitea

Hello,

i’m running Drone on my own server in a Docker container and synchronize my Gitea repositories with it but is shows only the first ten repositories which have a .drone.yml file in it.
Even in the search i can’t find the repos.
Everyone can help to solve this issue?

hmm I cannot reproduce and we have not received any other reports of this issue (many Gitea maintainers also use Drone). I see 10 Gitea repositories on my dashboard and then I click the “Show all repositories” button at the bottom of the screen and it expands to show all of my repositories.



I can also access the user repository endpoint and see a list of all my repositories:
https://docs.drone.io/api/repos/repo_list/

Yes, i’ve tested this in the cloud version of drone.io with my github account and it reads all the repositories and i can click ‘Show all repositories’.
But if i install it on my server and also the docker runner it only loads 10 repos and the button ‘Show all repositories’ is not there.
I can only access the repositories that are loaded and nothing more.
The strange thing is that if i delete a few .drone.yml files so that i have less then 10 repos with the drone files and i click on sync it syncs the repos with the drone files in it and i can access them.
Can i post somewhere a verbose log? Also can someone tell my how to turn on the full log?

You can find logging options at docs.drone.io

Here is a screenshot from the get command:

Here is the link to the log:

Click

A screenshot from the main Drone page (there is no ‘Show all repositories’):

A screenshot from my Gitea repositories:

(Sorry had to do this in 3 posts, can only upload one picture per post)

that seems unexpected. I recommend enabling trace logging and looking at the Drone repository sync code to learn more [1]. As I am unable to reproduce any issues with Drone + Gitea there is not much we can do other than agree to review any patches that you submit, should you find a problem with Drone.

[1] https://github.com/drone/drone/tree/master/service/syncer

Sorry but i’m not much into coding with GO, so i will switch to something other than Drone.
Anyway thanks for the replys.

I’ve now tested it with Github and everything is working as expected.
I think that it has something to do with the Gitea plugin but since i’m not really into this i can’t help.

Same bug for me : I have 3 docker containers on one host : gitea latest + drone latest + drone runner latest

It must be a mistake with pagination when calling gitea api.
I don’t know GO either so i dont know how i could help but can you confirm that the code is calling /user/repos
then /user/repos?page=2 and so on ?

If not i have a very easy workarround. You could set the limit to 50.
/user/repos?limit=50
could resolve my problem because i only have like 20 projects.
until the pagination mistake is solved.

please let me know if it is ok.

I just installed the latest Drone and Gitea today, and then got the same issue. Only 10 repos are shown up and there is no “Show all repositories”.

I have switched to Jenkins because no one is interested in solving the problem. Sadly I can’t help.

Just a reminder that Drone is open source and, if you are experiencing issues, you are encouraged to send a pull request.

FYI on the gitea side it was probably caused by this change: https://github.com/go-gitea/gitea/pull/9452 and the impact on Drone is being discussed here: https://github.com/go-gitea/gitea/issues/11800

BTW it is possible to use drone+gitea in the current state because the gitea pagination returns most-recently-changed first, so you can work on recent repos.

Yes, looks like a regression of sorts since the integration was created before pagination existed. Adding pagination to the codebase should be relatively straight forward.

Pagination would need to be added to the code here:

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"

The gitea folks seem to be working on this from multiple angles, but as of right now I pulled gitea/gitea:latest (self-identifies as 1.13.0+dev) and drone can see all of my repos without any reconfiguration. I didn’t dig into the changelists, so this may only be allowing configuration of the default page size (making it larger than 10) but it should be enough to get people going.

@bjj thanks for the details. I created the following issue to track:

I posted this in the issue, but it doesn’t look like anyone is subscribed to that. I hope it’s ok for me to cross post here.

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).

I have setup a gitea instance using the just released Gitea 1.12.0, added drone via oauth, logged in with my account that is having >30 repos … and I found the syncing icon to just spin forever.

I can’t find anything useful in the drone log (DRONE_LOGS_DEBUG set to true already).

Gitea however displays multiple requests to /api/v1/user/repos per second for minutes (until I just stop drone).

Please let me know how I can help debuging this issue.