Documentation
¶
Overview ¶
Package config validates and gives access to ResultDB LUCI config.
Index ¶
- Variables
- func CreatePlaceHolderServiceConfig() *configpb.Config
- func CreatePlaceholderProjectConfig() *configpb.ProjectConfig
- func GetServiceConfig(ctx context.Context) (*configpb.Config, error)
- func Project(ctx context.Context, project string) (*configpb.ProjectConfig, error)
- func Projects(ctx context.Context) (map[string]*configpb.ProjectConfig, error)
- func SetServiceConfigForTesting(ctx context.Context, cfg *configpb.Config) error
- func SetServiceConfigWithMetaForTesting(ctx context.Context, cfg *configpb.Config, meta *config.Meta) error
- func SetTestProjectConfig(ctx context.Context, cfg map[string]*configpb.ProjectConfig) error
- func UpdateConfig(ctx context.Context) error
- func UpdateProjects(ctx context.Context) error
- func UpdateServiceConfig(ctx context.Context) error
- type CompiledServiceConfig
- type Scheme
- type SchemeLevel
Constants ¶
This section is empty.
Variables ¶
var ( // Returned if configuration for a given project does not exist. ErrNotFoundProjectConfig = fmt.Errorf("no project config found") )
var GCSBucketRE = regexp.MustCompile(`^[a-z0-9_\.\-]{3,222}$`)
var HumanReadableRE = regexp.MustCompile(`^[[:print:]]{1,100}$`)
var SchemeIDRE = regexp.MustCompile(`^[a-z][a-z0-9]{0,19}$`)
Functions ¶
func CreatePlaceholderProjectConfig ¶
func CreatePlaceholderProjectConfig() *configpb.ProjectConfig
CreatePlaceholderProjectConfig creates a placeholder project config with default values.
func GetServiceConfig ¶
GetServiceConfig returns the cached service-level config
func Project ¶
Project returns the configurations of the requested project. Returns an ErrNotFoundProjectConfig error if config for the given project does not exist.
func Projects ¶
Projects returns all project configurations, in a map by project name. Uses in-memory cache to avoid hitting datastore all the time. Note that the config may be stale by up to 1 minute.
func SetServiceConfigForTesting ¶
SetServiceConfigForTesting installs the service configuration into the context ctx. This is only used for the purpose of testing.
func SetServiceConfigWithMetaForTesting ¶
func SetServiceConfigWithMetaForTesting(ctx context.Context, cfg *configpb.Config, meta *config.Meta) error
SetServiceConfigWithMetaForTesting installs the service configuration into the context ctx, with the given metadata. This is only used for the purpose of testing.
func SetTestProjectConfig ¶
SetTestProjectConfig sets test project configuration in datastore. It should be used from unit/integration tests only.
func UpdateConfig ¶
UpdateConfig is called from a cron periodically; it fetches the latest service-wide config and project config from the LUCI Config service and caches them into the datastore
func UpdateProjects ¶
UpdateProjects fetches fresh project-level configuration from LUCI Config service and stores it in datastore.
func UpdateServiceConfig ¶
UpdateServiceConfig fetches the latest service config and caches it in datastore.
Types ¶
type CompiledServiceConfig ¶
type CompiledServiceConfig struct { // The raw service configuration. Config *configpb.Config Revision string // The compiled scheme configuration, by scheme ID. Schemes map[string]*Scheme }
CompiledServiceConfig is a copy of service configuration with regular expression pre-compiled. This object must be treated as immutable.
func NewCompiledServiceConfig ¶
func NewCompiledServiceConfig(cfg *configpb.Config, revision string) (*CompiledServiceConfig, error)
NewCompiledServiceConfig compiles the given raw service config into a form that is faster to apply.
type Scheme ¶
type Scheme struct { // The identifier of the scheme. ID string // The human readable scheme name. HumanReadableName string // Configuration for the coarse name level. // If set, the scheme uses the coarse name level. Coarse *SchemeLevel // Configuration for the fine name level. // If set, the fine name. Fine *SchemeLevel // Configuration for the case name level. // Always set. Case *SchemeLevel }
Scheme represents the configuration for a type of test. For example, JUnit or GTest.
type SchemeLevel ¶
type SchemeLevel struct { // The human readable name of the level. HumanReadableName string // The compiled validation regular expression. // May be nil if no validation is to be appled. ValidationRegexp *regexp.Regexp }
SchemeLevel represents a test hierarchy level in a test scheme.
func NewSchemeLevel ¶
func NewSchemeLevel(level *configpb.Scheme_Level) (*SchemeLevel, error)