Allow Zoekt to index private repositories
What does this MR do and why?
This change is behind a feature flag use_new_zoekt_indexer
This MR allows the new indexer, support for which has been merged in !122308 (merged), to index private and internal projects.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Add these lines to your
gdk.yml
zoekt:
enabled: true
- Execute
gdk reconfigure
- Run these commands in you rails console to add the
flightjs
namespace to Zoekt
::Feature.enable(:index_code_with_zoekt)
::Feature.enable(:search_code_with_zoekt)
::Feature.enable(:use_new_zoekt_indexer)
zoekt_shard = ::Zoekt::Shard.find_or_create_by!(index_base_url: 'http://127.0.0.1:6080/', search_base_url: 'http://127.0.0.1:6090/')
namespace = Namespace.find_by_full_path("flightjs") # Some namespace you want to enable
::Zoekt::IndexedNamespace.find_or_create_by!(shard: zoekt_shard, namespace: namespace.root_ancestor)
- Change the visibility of the flightjs project to private
- Set your GDK_DIR:
export GDK_DIR=/full/path/to/gdk
- Install
gitlab-zoekt-indexer
:GOBIN=$GDK_DIR/zoekt/bin go install gitlab.com/gitlab-org/search-team/gitlab-zoekt-indexer/cmd/gitlab-zoekt-indexer@latest
- Run
cd $GDK_DIR && gdk stop zoekt-dynamic-indexserver-development && ./zoekt/bin/gitlab-zoekt-indexer -index_dir zoekt-data/development/index -listen :6080
- Run
project = Project.find_by_full_path('flightjs/Flight'); project.repository.update_zoekt_index!
. Ensure that it returns{"Success"=>true}
- Perform search in a project inside the
flightjs
namespace. Ensure that it returns results
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #389741 (closed)
Edited by Dmitry Gruzd