问题
I am updating a sourcegraph's projectQuery configuration for gitlab but gitlab's (for the version I have) max count per page is 100 therefore, I can not get all the projects in a single query because I have more than 100 projects although I can add additional queries to fetch multiple projects but this I have to monitor and keep track of if the new projects are added that does not seems ntutive.
project query could look like this
"projectQuery": [
"../v4/projects?per_page=100&page=1",
"../v4/projects?per_page=100&page=2",
...
...
]
how can I improve this, a script could be better or extracts all the projects and add them to projects
's key in the config? I am asking here because this looks a very generic question
回答1:
Try using python-gitlab
From reading the documentation, it seems that
gitlab project list --all
ought to return a list of all projects.
You can install it with:
pip install python-gitlab
来源:https://stackoverflow.com/questions/61664510/fetch-projects-greater-than-100-from-gitlab-for-sourcegraph-projectquery