config

package
v0.0.0-...-5952ad4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package config knows how to read and parse config.yaml.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Agent watches a path and automatically loads the config stored therein.

func (*Agent) Config

func (ca *Agent) Config() *Config

Config returns the latest config. Do not modify the config.

func (*Agent) Start

func (ca *Agent) Start(path string) error

Start will begin polling the config file at the path. If the first load fails, Start with return the error and abort. Future load failures will log the failure message but continue attempting to load.

type Brancher

type Brancher struct {
	// Do not run against these branches. Default is no branches.
	SkipBranches []string `json:"skip_branches"`
	// Only run against these branches. Default is all branches.
	Branches []string `json:"branches"`
}

Brancher is for shared code between jobs that only run against certain branches. An empty brancher runs against all branches.

func (Brancher) RunsAgainstBranch

func (br Brancher) RunsAgainstBranch(branch string) bool

type Config

type Config struct {
	// Full repo name (such as "kubernetes/kubernetes") -> list of jobs.
	Presubmits  map[string][]Presubmit  `json:"presubmits,omitempty"`
	Postsubmits map[string][]Postsubmit `json:"postsubmits,omitempty"`

	// Periodics are not associated with any repo.
	Periodics []Periodic `json:"periodics,omitempty"`

	Plank    Plank     `json:"plank,omitempty"`
	Triggers []Trigger `json:"triggers,omitempty"`
}

Config is a read-only snapshot of the config.

func Load

func Load(path string) (*Config, error)

Load loads and parses the config at path.

func (*Config) AllPeriodics

func (c *Config) AllPeriodics() []string

func (*Config) AllPostsubmits

func (c *Config) AllPostsubmits() []string

func (*Config) AllPresubmits

func (c *Config) AllPresubmits() []string

func (*Config) MatchingPresubmits

func (c *Config) MatchingPresubmits(fullRepoName, body string, testAll *regexp.Regexp) []Presubmit

func (*Config) RetestPresubmits

func (c *Config) RetestPresubmits(fullRepoName string, skipContexts, runContexts map[string]bool) []Presubmit

RetestPresubmits returns all presubmits that should be run given a /retest command. This is the set of all presubmits intersected with ((alwaysRun + runContexts) - skipContexts)

func (*Config) SetPresubmits

func (c *Config) SetPresubmits(jobs map[string][]Presubmit) error

type Periodic

type Periodic struct {
	Name     string        `json:"name"`
	Spec     *kube.PodSpec `json:"spec,omitempty"`
	Interval string        `json:"interval"`
	Tags     []string      `json:"tags,omitempty"`

	RunAfterSuccess []Periodic `json:"run_after_success"`
	// contains filtered or unexported fields
}

Periodic runs on a timer.

func (*Periodic) GetInterval

func (p *Periodic) GetInterval() time.Duration

func (*Periodic) SetInterval

func (p *Periodic) SetInterval(d time.Duration)

type Plank

type Plank struct {
	// JobURLTemplateString compiles into JobURLTemplate at load time.
	JobURLTemplateString string `json:"job_url_template,omitempty"`
	// JobURLTemplate is compiled at load time from JobURLTemplateString. It
	// will be passed a kube.ProwJob and is used to set the URL for the
	// "details" link on GitHub as well as the link from deck.
	JobURLTemplate *template.Template `json:"-"`

	// ReportTemplateString compiles into ReportTemplate at load time.
	ReportTemplateString string `json:"report_template,omitempty"`
	// ReportTemplate is compiled at load time from ReportTemplateString. It
	// will be passed a kube.ProwJob and can provide an optional blurb below
	// the test failures comment.
	ReportTemplate *template.Template `json:"-"`
}

Plank is config for the plank controller.

type Postsubmit

type Postsubmit struct {
	Name string        `json:"name"`
	Spec *kube.PodSpec `json:"spec,omitempty"`

	Brancher

	RunAfterSuccess []Postsubmit `json:"run_after_success"`
}

Postsubmit runs on push events.

type Presubmit

type Presubmit struct {
	// eg kubernetes-pull-build-test-e2e-gce
	Name string `json:"name"`
	// Run for every PR, or only when a comment triggers it.
	AlwaysRun bool `json:"always_run"`
	// Run if the PR modifies a file that matches this regex.
	RunIfChanged string `json:"run_if_changed"`
	// Context line for GitHub status.
	Context string `json:"context"`
	// eg @k8s-bot e2e test this
	Trigger string `json:"trigger"`
	// Valid rerun command to give users. Must match Trigger.
	RerunCommand string `json:"rerun_command"`
	// Whether or not to skip commenting and setting status on GitHub.
	SkipReport bool `json:"skip_report"`
	// Kubernetes pod spec.
	Spec *kube.PodSpec `json:"spec,omitempty"`
	// Run these jobs after successfully running this one.
	RunAfterSuccess []Presubmit `json:"run_after_success"`

	Brancher
	// contains filtered or unexported fields
}

Presubmit is the job-specific trigger info.

func (Presubmit) RunsAgainstChanges

func (ps Presubmit) RunsAgainstChanges(changes []string) bool

type Trigger

type Trigger struct {
	// Repos is either of the form org/repos or just org.
	Repos []string `json:"repos,omitempty"`
	// TrustedOrg is the org whose members' PRs will be automatically built
	// for PRs to the above repos.
	TrustedOrg string `json:"trusted_org,omitempty"`
}

Trigger is config for the trigger plugin.

Jump to

Keyboard shortcuts

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