Documentation ¶
Overview ¶
Package config implements service-level config for LUCI Source Index.
Package config implements service-level config for LUCI Source Index.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var IndexableRefPrefixes = []string{
"refs/branch-heads/",
"refs/heads/",
}
IndexableRefPrefixes is a list of ref prefixes from which the commits can be indexed.
We should not index commits of arbitrary refs (e.g. Gerrit CL patch refs) as they may not have been merged into one of the branches. We don't want to resolve commit positions to unmerged CLs.
Keep in sync with the service config documentation `luci.source_index.config.Config.Host.Repository.include_ref_regexes`
var TestCfg = &configpb.Config{ Hosts: []*configpb.Config_Host{ { Host: "chromium.googlesource.com", Repositories: []*configpb.Config_Host_Repository{ { Name: "chromium/src", IncludeRefRegexes: []string{ "^refs/branch-heads/.+$", "refs/heads/main", "^refs/arbitrary/.+$", }, }, { Name: "chromiumos/manifest", IncludeRefRegexes: []string{"^refs/heads/staging-snapshot$"}, }, { Name: "v8/v8", IncludeRefRegexes: []string{"^refs/heads/main$"}, }, }, }, { Host: "webrtc.googlesource.com", Repositories: []*configpb.Config_Host_Repository{ { Name: "src", IncludeRefRegexes: []string{"^refs/heads/main$"}, }, }, }, }, }
TestCfg is a configuration used for testing purpose. It mimics the configuration for the staging environment.
Functions ¶
func RegisterCronHandlers ¶
RegisterCronHandlers registers cron handlers for managing Source Index's configuration.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a wrapper around `*configpb.Config` that provides some methods for interacting with the Config.
func (Config) HostConfigs ¶
func (c Config) HostConfigs() []HostConfig
HostConfigs returns a list of host configs.
func (Config) ShouldIndexRef ¶
ShouldIndexRef returns whether the specified ref should be indexed.
func (Config) ShouldIndexRepo ¶
ShouldIndexRepo returns whether the specified repository should be indexed.
type HostConfig ¶
type HostConfig struct {
// contains filtered or unexported fields
}
HostConfig is a wrapper around `*configpb.Config_Host` that provides some methods for interacting with the host config.
func (HostConfig) RepoConfigs ¶
func (hc HostConfig) RepoConfigs() []RepositoryConfig
RepoConfigs returns a list of repository configs.
type RepositoryConfig ¶
type RepositoryConfig struct {
// contains filtered or unexported fields
}
RepositoryConfig is a wrapper around `*configpb.Config_Host_Repository` that provides some methods for interacting with the repository config.
func (RepositoryConfig) Name ¶
func (rc RepositoryConfig) Name() string
Name returns the name of the repository.
func (RepositoryConfig) ShouldIndexRef ¶
func (rc RepositoryConfig) ShouldIndexRef(ref string) bool
ShouldIndexRef returns whether the specified ref should be indexed.