Enable code navigation auto-indexing
This how-to explains how to turn on auto-indexing on your Sourcegraph instance to enable precise code navigation.
Deploy executors
First, deploy the executor service targeting your Sourcegraph instance. This will provide the necessary compute resources that clone the target Git repository, securely analyze the code to produce a code graph data index, then upload that index to your Sourcegraph instance for processing.
Enable index job scheduling
Next, enable the precise code navigation auto-indexing feature by enabling the following feature flag in your Sourcegraph instance's site configuration.
{ "codeIntelAutoIndexing.enabled": true }
This step will control the scheduling of indexing jobs which are made available to the executors deployed in the previous step.
Configure auto-indexing policies
Once auto-indexing has been enabled, create auto-indexing policies to control the set of repositories and commits that are eligible for indexing. Note that policies only select repositories and branches/tags/commits that can be indexed, not how they are indexed. The how is handled in the next section.
Configure auto-indexing jobs
For repository and commit pairs that are marked as eligible for indexing, the index job is either inferred from the project, or explicitly configured on a per-repository basis.
Tune the index scheduler
The frequency of index job scheduling can be tuned via the following environment variables read by worker
service containers running the codeintel-auto-indexing
task.
PRECISE_CODE_INTEL_AUTO_INDEXING_TASK_INTERVAL
: The frequency with which to run periodic codeintel auto-indexing tasks. Default is every 2 minutes.
PRECISE_CODE_INTEL_AUTO_INDEXING_REPOSITORY_PROCESS_DELAY
: The minimum frequency that the same repository can be considered for auto-index scheduling. Default is every 24 hours.
PRECISE_CODE_INTEL_AUTO_INDEXING_REPOSITORY_BATCH_SIZE
: The number of repositories to consider for auto-indexing scheduling at a time. Default is 2500.
PRECISE_CODE_INTEL_AUTO_INDEX_MAXIMUM_REPOSITORIES_INSPECTED_PER_SECOND
: The maximum number of repositories inspected for auto-indexing per second. Set to zero to disable limit. Default is 0.
Access to private repositories and packages
Auto-indexing jobs run as Docker containers on the Executors infrastructure, and by default don't have any knowledge about the private repositories or package registries your builds might use.
The type of information you will need to provide depends on the language and ecosystem, but the mechanism is the same - adding a secret to Executors "Code Graph" namespace.
See the language-specific instructions