config

package
v0.0.0-...-d3da680 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package config implements app-level configs for LUCI Analysis.

Index

Constants

View Source
const ProjectCacheExpiry = 1 * time.Minute

ProjectCacheExpiry defines how often project configuration stored in the in-process cache is refreshed from datastore.

View Source
const RefHashRePattern = `[0-9a-f]{16}`

RefHashRePattern is the regular expression pattern that matches validly formed Ref Hash.

View Source
const VariantHashRePattern = `[0-9a-f]{16}`

VariantHashRePattern is the regular expression pattern that matches validly formed Variant Hash.

Variables

View Source
var ChromiumMilestoneProjectRe = regexp.MustCompile(`^(chrome|chromium)-m[0-9]+$`)

ChromiumMilestoneProjectRe is the chromium milestone projects, e.g. chromium-m100.

View Source
var StartingEpoch = time.Date(1900, time.January, 1, 0, 0, 0, 0, time.UTC)

StartingEpoch is the earliest valid config version for a project. It is deliberately different from the timestamp zero value to be discernible from "timestamp not populated" programming errors.

Functions

func CreateConfigWithBothBuganizerAndMonorail

func CreateConfigWithBothBuganizerAndMonorail(defaultBugSystem configpb.BugSystem) *configpb.ProjectConfig

CreateConfigWithBothBuganizerAndMonorail creates a placeholder config for a project that uses both Monorail and Buganizer.

func CreatePlaceholderBugManagementPolicy

func CreatePlaceholderBugManagementPolicy(id string) *configpb.BugManagementPolicy

func CreatePlaceholderConfig

func CreatePlaceholderConfig() (*configpb.Config, error)

CreatePlaceholderConfig returns a new valid Config for testing.

func Get

func Get(ctx context.Context) (*configpb.Config, error)

Get returns the service-level config.

func IsProjectEnabledForIngestion

func IsProjectEnabledForIngestion(ctx context.Context, project string) (bool, error)

IsProjectEnabledForIngestion returns if the LUCI project is enabled for ingestion. By default, all LUCI projects are enabled for ingestion, but it is possible to limit ingestion to an allowlisted set in the service configuration.

func NewEmptyProject

func NewEmptyProject() *configpb.ProjectConfig

NewEmptyProject returnes an empty project config.

func Project

func Project(ctx context.Context, project string) (*configpb.ProjectConfig, error)

Project returns the configuration of the requested project.

func ProjectWithMinimumVersion

func ProjectWithMinimumVersion(ctx context.Context, project string, minimumVersion time.Time) (*configpb.ProjectConfig, error)

ProjectWithMinimumVersion returns the configuration of the requested project, which has a LastUpdated time of at least minimumVersion. This bypasses the in-process cache if the cached version is older than the specified version.

func SetTestConfig

func SetTestConfig(ctx context.Context, cfg *configpb.Config) error

SetTestConfig set test configs in the cachedCfg.

func SetTestProjectConfig

func SetTestProjectConfig(ctx context.Context, cfg map[string]*configpb.ProjectConfig) error

SetTestProjectConfig sets test project configuration in datastore. It should be used from unit/integration tests only.

func Update

func Update(ctx context.Context) error

Update fetches the latest config and puts it into the datastore.

func ValidateProjectConfig

func ValidateProjectConfig(ctx *validation.Context, project string, cfg *configpb.ProjectConfig)

func ValidateRunesGraphicOrNewline

func ValidateRunesGraphicOrNewline(value string, maxLengthInBytes int) error

ValidateRunesGraphicOrNewline validates a value: - is non-empty - is a valid UTF-8 string - contains only runes matching unicode.IsGraphic or '\n', and - has a specified maximum length.

Types

type ProjectConfigs

type ProjectConfigs struct {
	// contains filtered or unexported fields
}

ProjectConfigs represents the physcial to logical content translation of project configs.

func Projects

func Projects(ctx context.Context) (ProjectConfigs, error)

Projects returns all project configurations, in a map by project name. Uses in-memory cache to avoid hitting datastore all the time.

func (*ProjectConfigs) Keys

func (p *ProjectConfigs) Keys() []string

Keys returns all projects that have a record in datastore. It can be a project that currently have a config or had a config before but then deleted.

func (*ProjectConfigs) Project

func (p *ProjectConfigs) Project(project string) *configpb.ProjectConfig

Project returns the logical project config.

Directories

Path Synopsis
Package compiledcfg contains compiled versions of the LUCI Analysis config.
Package compiledcfg contains compiled versions of the LUCI Analysis config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL