Skip to content

Zoekt: Enable internalApi by default

Dmitry Gruzd requested to merge 438493-enable-internal-api-by-default into master

What does this MR do?

This MR enables Zoekt internal API by default as well as updates the documentation. We're doing that to prepare for the SM Zoekt Alpha launch. This reduces the effort to set up Zoekt.

Related issues

Related to gitlab-org/gitlab#438493 (closed)

Testing

git@charts-toolbox-7d75d44588-htgtl:/$ gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
 GitLab:       16.9.0-pre (08ce5c4693a) EE
 GitLab Shell: 14.32.0
 PostgreSQL:   14.8
------------------------------------------------------------[ booted in 54.12s ]
Loading production environment (Rails 7.0.8)
irb(main):001:0> ::Feature.enable(:index_code_with_zoekt)
irb(main):001:0> ::Feature.enable(:index_code_with_zoekt)
WARNING: Understand the stability and security risks of enabling in-development features with feature flags.
See https://docs.gitlab.com/ee/administration/feature_flags.html#risks-when-enabling-features-still-in-development for more information.
=> true
irb(main):002:0> ::Feature.enable(:search_code_with_zoekt)
irb(main):002:0> ::Feature.enable(:search_code_with_zoekt)
WARNING: Understand the stability and security risks of enabling in-development features with feature flags.
See https://docs.gitlab.com/ee/administration/feature_flags.html#risks-when-enabling-features-still-in-development for more information.
=> true
irb(main):003:0> node = ::Search::Zoekt::Node.last
=>
#<Search::Zoekt::Node:0x00007fd1b35b3448
...
irb(main):004:0> namespace = Namespace.find_by_full_path('zoekt-test')
=> #<Group id:2 @zoekt-test>
irb(main):005:0> enabled_namespace = Search::Zoekt::EnabledNamespace.find_or_create_by(namespace: namespace)
=>
#<Search::Zoekt::EnabledNamespace:0x00007fd1abfc49a8
...
irb(main):006:0> node.indices.create!(zoekt_enabled_namespace_id: enabled_namespace.id, namespace_id: namespace.id, state: :ready)
=>
#<Search::Zoekt::Index:0x00007fd1abbc85c0
 id: 1,
 zoekt_enabled_namespace_id: 1,
 zoekt_node_id: 2,
 namespace_id: 2,
 created_at: Fri, 19 Jan 2024 17:26:54.147859146 UTC +00:00,
 updated_at: Fri, 19 Jan 2024 17:26:54.147859146 UTC +00:00,
 state: "ready">
irb(main):007:0>

Author checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • When ready for review, follow the instructions in the "Reviewer Roulette" section of the Danger Bot MR comment, as per the Distribution experimental MR workflow

For merge requests from forks, consider the following options for Danger to work properly:

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added/updated
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for omnibus-gitlab opened
  • Equivalent MR/issue for Gitlab Operator project opened (see Operator documentation on impact of Charts changes)
  • Validate potential values for new configuration settings. Formats such as integer 10, duration 10s, URI scheme://user:passwd@host:port may require quotation or other special handling when rendered in a template and written to a configuration file.
Edited by Dmitry Gruzd

Merge request reports