Skip to content

Allow Zoekt to index private repositories

Dmitry Gruzd requested to merge 389741-zoekt-index-private-repositories into master

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

  1. Add these lines to your gdk.yml
zoekt:
  enabled: true
  1. Execute gdk reconfigure
  2. 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)
  1. Change the visibility of the flightjs project to private
  2. Set your GDK_DIR: export GDK_DIR=/full/path/to/gdk
  3. 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
  4. Run cd $GDK_DIR && gdk stop zoekt-dynamic-indexserver-development && ./zoekt/bin/gitlab-zoekt-indexer -index_dir zoekt-data/development/index -listen :6080
  5. Run project = Project.find_by_full_path('flightjs/Flight'); project.repository.update_zoekt_index!. Ensure that it returns {"Success"=>true}
  6. 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.

Related to #389741 (closed)

Edited by Dmitry Gruzd

Merge request reports