config

package
v0.0.0-...-a96dc21 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SkCQCfgPath = "infra/skcq.json"
)

Variables

This section is empty.

Functions

func IsCannotModifyCfgsOnTheFly

func IsCannotModifyCfgsOnTheFly(err error) bool

func IsNotFound

func IsNotFound(err error) bool

Types

type CannotModifyCfgsOnTheFlyError

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

CannotModifyCfgsOnTheFlyError is returned when the owner of the change does not have permission to modify the cfg.

func (*CannotModifyCfgsOnTheFlyError) Error

type ConfigNotFoundError

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

ConfigNotFoundError is returned when a cfg is not found in the repo+branch.

func (*ConfigNotFoundError) Error

func (e *ConfigNotFoundError) Error() string

type ConfigReader

type ConfigReader interface {
	// GetSkCQCfg reads the SkCQ cfg file from CL's ref if it was modified, else
	// it reads it from HEAD.
	GetSkCQCfg(ctx context.Context) (*SkCQCfg, error)

	// GetTasksCfg reads the Tasks.json file from CL's ref if it was modified, else
	// it reads it from HEAD.
	GetTasksCfg(ctx context.Context, tasksJSONPath string) (*specs.TasksCfg, error)

	// GetAuthorsFileContents reads the AUTHORS file from CL's ref if it was modified,
	// else it reads it from HEAD.
	GetAuthorsFileContents(ctx context.Context, authorsPath string) (string, error)
}

ConfigReader is an interface to read configs for SkCQ. Useful for testing.

type GitilesConfigReader

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

GitilesConfigReader is an implementation of ConfigReader interface.

func NewGitilesConfigReader

func NewGitilesConfigReader(ctx context.Context, httpClient *http.Client, ci *gerrit.ChangeInfo, cr codereview.CodeReview, canModifyCfgsOnTheFly allowed.Allow) (*GitilesConfigReader, error)

NewGitilesConfigReader returns an instance of GitilesConfigReader.

func (*GitilesConfigReader) GetAuthorsFileContents

func (gc *GitilesConfigReader) GetAuthorsFileContents(ctx context.Context, authorsPath string) (string, error)

GetAuthorsFileContents implements the ConfigReader interface.

func (*GitilesConfigReader) GetSkCQCfg

func (gc *GitilesConfigReader) GetSkCQCfg(ctx context.Context) (*SkCQCfg, error)

GetSkCQCfg implements the ConfigReader interface.

func (*GitilesConfigReader) GetTasksCfg

func (gc *GitilesConfigReader) GetTasksCfg(ctx context.Context, tasksJSONPath string) (*specs.TasksCfg, error)

GetTasksCfg implements the ConfigReader interface.

type SkCQCfg

type SkCQCfg struct {

	// Determines where changes from this repo will be stored in Firestore and
	// which frontend instance will be used to display results. Also determines
	// which BuildBucket bucket will be used when triggering/querying for
	// try jobs.
	VisibilityType VisibilityType `json:"visibility_type"`

	// Full path to tasks.json file to get list of CQ try jobs from.
	TasksJSONPath string `json:"tasks_json_path,omitempty"`

	// Name of the go/cria group that includes the list of people allowed to
	// commit to this repo+branch.
	CommitterList string `json:"committer_list"`

	// Name of the go/cria group that includes the list of people allowed to
	// run dry-runs on this repo+branch.
	DryRunAccessList string `json:"dry_run_access_list"`

	// The URL of the tree status instance that will gate submissions to this
	// repo+branch when the tree is closed.
	TreeStatusURL string `json:"tree_status_url,omitempty"`

	// The throttler config that will gate the rate of submissions to this
	// repo+branch.
	ThrottlerCfg *ThrottlerCfg `json:"throttler_cfg,omitempty"`

	// Full path to the AUTHORS file. If this is specified then SkCQ will
	// run the authors_verifier on the change to validate that the author
	// of the change is specified in the AUTHORS file.
	AuthorsPath string `json:"authors_path,omitempty"`
}

SkCQCfg is a struct which describes the SkCQ config for a repo+branch at a particular commit.

func ParseSkCQCfg

func ParseSkCQCfg(contents string) (*SkCQCfg, error)

ParseSkCQCfg is a utility function that parses the given SkCQ cfg file contents and returns the config.

func (*SkCQCfg) Validate

func (c *SkCQCfg) Validate() error

Validate returns an error if the SkCQCfg is not valid.

type ThrottlerCfg

type ThrottlerCfg struct {
	// How many commits are allowed within BurstDelaySecs. Default used is
	// throttler.MaxBurstDefault.
	MaxBurst int `json:"max_burst"`
	// The window of seconds MaxBurst commits are allowed in. Default used is
	// throttler.BurstDelaySecs.
	BurstDelaySecs int `json:"burst_delay_secs"`
}

ThrottlerCfg is a struct which describes how the rate of submissions to this repo+branch will be gated.

type VisibilityType

type VisibilityType string
const InternalVisibility VisibilityType = "internal"
const PublicVisibility VisibilityType = "public"
const StagingVisibility VisibilityType = "staging"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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