6

I am trying to find a way to search multiple project's code in gitlab CE.

Has anyone encountered this before, or have a recommended approach?

(I realize that if this is even possible, then I would likely need to create a script that mimics the current call from the GUI multiple times and combine the results. )

Liv MacIntosh
  • 153
  • 1
  • 10

2 Answers2

-2

Recently came into a similar need. My particular use case is a self-hosted instance of GitLab CE. Seems like it's possible to use GitLab's API where the scope is limited to snippet, then loop through your groups and projects.

Example code:

https:// (instance_server) /search?utf8=%E2%9C%93&snippets=&scope=&search= (key words) &group_id=22&project_id=81

Other links:

GitLab's paid version. https://docs.gitlab.com/ee/user/search/advanced_search_syntax.html#syntax-search-filters

Mention of original request (closed) https://gitlab.com/gitlab-org/gitlab-ce/issues/14597 https://forum.gitlab.com/t/search-code-across-all-projects/2263 (SourceGraph)

Claire
  • 3,146
  • 6
  • 22
  • 37
-3

If you want to (or are okay with) searching all of the projects in a single GitLab (Enterprise?) instance, the existing search feature (as-of 2023-4-22) can do this.

If you're using a shared GitLab instance (e.g. gitlab.com), right now, AFAIK, the only way to do this in the existing GitLab UI is to create a group, migrate or move all of the projects you want to search to that group, and then search just that group. (Yes, this is or can be a steep cost, and it's an annoying requirement.)

Otherwise, you'll need to find (e.g. this) or develop some kind of tool to use the GitLab search API for the projects you want to search and then combine the results somehow:

Search (REST) API:

Kenny Evitt
  • 9,291
  • 5
  • 65
  • 93