config

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LuciConfigServer configProvider

LuciConfigServer provides configs fetched from luci-config.

The configs are fetched in a cron job and stored in datastore.

View Source
var MockProvider mockProvider

MockProvider mocks the ProviderAPI interface.

Tests using the return values should implement their own mock.

View Source
var WorkflowCache workflowCache

WorkflowCache implements the WorkflowCacheAPI using Datastore.

Functions

func Generate

func Generate(sc *tricium.ServiceConfig, pc *tricium.ProjectConfig,
	files []*tricium.Data_File, gitRef, gitURL string) (*admin.Workflow, error)

Generate generates a Tricium workflow based on the provided configs and paths to analyze.

Previously a workflow would be a tree including isolators. Now, all functions should be recipe-based analyzers and workflows just have a list of workers, filtered based on path filters, although in practice, most path filtering will happen inside recipes.

func UpdateAllConfigs

func UpdateAllConfigs(c context.Context) error

UpdateAllConfigs updates all configs.

This includes updating and removing project configs when necessary and updating the service config if necessary.

func Validate

func Validate(sc *tricium.ServiceConfig, pc *tricium.ProjectConfig) error

Validate validates the provided project config using the provided service config.

They are validated together because a project config may contain a selection which is valid or invalid depending on the service config.

Returns an error if invalid, or nil if valid.

func WithConfigService

func WithConfigService(c context.Context, iface luciConfig.Interface) context.Context

WithConfigService sets a config interface in the context.

Types

type ProviderAPI

type ProviderAPI interface {
	// GetServiceConfig loads the service config from luci-config.
	GetServiceConfig(c context.Context) (*tricium.ServiceConfig, error)

	// GetProjectConfig loads one project config for the provided project.
	GetProjectConfig(c context.Context, project string) (*tricium.ProjectConfig, error)

	// GetAllProjectConfigs fetches a map of project names to project configs.
	GetAllProjectConfigs(c context.Context) (map[string]*tricium.ProjectConfig, error)
}

ProviderAPI supplies Tricium service and project configs.

type Workflow

type Workflow struct {
	// The run ID for the workflow.
	ID int64 `gae:"$id"`

	// Serialized workflow config proto.
	SerializedWorkflow []byte `gae:",noindex"`
}

Workflow config entry for storing in datastore.

type WorkflowCacheAPI

type WorkflowCacheAPI interface {
	// GetWorkflow returns the stored workflow for the provided run ID.
	GetWorkflow(c context.Context, runID int64) (*admin.Workflow, error)
}

WorkflowCacheAPI stores generated workflows.

Jump to

Keyboard shortcuts

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