Loading
Draft: Pass chunk indexer credentials by environment
What does this MR do and why?
The chunk-mode indexer got the adapter connection and Gitaly settings as command-line arguments, which other local users can read. They now travel in the process environment, as advanced mode already does (indexer.rb). Non-secret options stay in -options.
Draft until the indexer MR is tagged: this change needs an indexer that reads the variables. The indexer version bump will be added to this MR once the tag exists.
flowchart LR
rails[Rails] -->|"adapter connection<br/>Gitaly settings"| env[Process environment]
rails -->|"non-secret options"| args[Command line]
env --> indexer[Chunk indexer]
args --> indexerReferences
- Confidential issue, with the details: https://gitlab.com/gitlab-org/gitlab/-/work_items/639629
- Indexer MR, which must merge and be tagged first: gitlab-elasticsearch-indexer!986
How to set up and validate locally
- Run
bundle exec rspec ee/spec/services/ai/active_context/code/indexer_spec.rb ee/spec/services/ai/active_context/code/deleter_spec.rb: 52 examples, 0 failures. - Removing the
GITALY_CONNECTION_INFOoverride fails 6 to 9 of them. Removing theCHUNK_CONNECTION_INFOoverride fails 22 to 34. - With the patched indexer,
active_context_index_integration_spec.rbran 12 examples with 0 failures against Elasticsearch, OpenSearch and PostgreSQL. - With the unpatched binary, 4 of 4 Elasticsearch examples fail, so the indexer version bump is required.
- The command line held none of the 7 secrets and the environment held all 7.
MR acceptance checklist
- RuboCop reports 0 offenses on the changed Ruby files
- Indexer version bumped once the tag exists
An AI coding assistant wrote this change. The assistant also checked each claim against the Rails and indexer sources it cites and ran RuboCop and the specs on the changed Ruby files on a test VM. The assistant also ran the integration spec against the built indexer on a test VM.