holmari / gerritstats

Tool for creating statistics from a Gerrit repository
MIT License
195 stars 54 forks source link

how to gather data from multiple gerrit servers and multiple projects? #28

Open ssbarnea opened 6 years ago

ssbarnea commented 6 years ago

It seems that the documentation lacks information about how to gather data from multiple gerrit instances and multiple projects.

The idea of downloading all projects where you have access to does not make any sense for anything else than very small deployments.

We use 4-5 instances, one internal and the rest public, like gerrithub.io which is HUGE and where we have projects under multiple organizations, so we need a way to gather these in a single place.

holmari commented 6 years ago

./gerrit_downloader.sh --server gerrit.instance.on.inter.nets --project YourProjectName should do the trick. If you want to download multiple projects under one instance, you can pass --project several times. Does that help?

ssbarnea commented 6 years ago

@holmari Thanks for the quick reply. In fact not really because I do want to download all project under a certain organization. On gerrithub the project name is like organization/project. I tried to specify only the organization and it failed to download, it seems that it requires full project name.

What I need is some sort of wildcard support. Please understand that we are talking about a bigger number of projects, a set that can even change in time.

Another issue that I spotted was that in order to make it possible to talk with gerrithub, I had to put -- server my_username@reviews.gerrithub.io which makes the script less portable. Probably that's a limitation due to the way ssh works on gerrtihub.

holmari commented 6 years ago

Got it. You're right, there's no support for wildcards at the moment. You can work around this problem pretty easily by issuing gerrit ls-projects over ssh on the remote server, and parsing the list and passing it to the downloader as --project arguments.

Alternatively, this kind of wildcard support could be implemented in Downloader.java, by checking if any of the passed project names have wildcards, and if yes, downloading the project listing as well as filtering them based on the wildcards. It doesn't sound like a lot of code - PR maybe? :-)

ssbarnea commented 6 years ago

I am not proficient in Java so I will workaround this by making a bash wrapper and ls-projects for the moment. If I am not wrong gerrit supports regex like patterns so maybe it would be easier than we think.