Documentation ¶
Overview ¶
Package jobutil contains helpers for working with LighthouseJobs.
Package jobutil contains helpers for working with ProwJobs.
Index ¶
- Variables
- func BatchSpec(p config.Presubmit, refs v1alpha1.Refs) v1alpha1.LighthouseJobSpec
- func FilterPresubmits(filter Filter, changes config.ChangedFilesProvider, branch string, ...) ([]config.Presubmit, []config.Presubmit, error)
- func JobURL(plank config.Plank, pj v1alpha1.LighthouseJob, log *logrus.Entry) string
- func LabelsAndAnnotationsForJob(lj v1alpha1.LighthouseJob, buildID string) (map[string]string, map[string]string)
- func LabelsAndAnnotationsForSpec(spec v1alpha1.LighthouseJobSpec, ...) (map[string]string, map[string]string)
- func LighthouseJobFields(pj *v1alpha1.LighthouseJob) logrus.Fields
- func NewLighthouseJob(spec v1alpha1.LighthouseJobSpec, ...) v1alpha1.LighthouseJob
- func NewPresubmit(pr *scm.PullRequest, baseSHA string, job config.Presubmit, eventGUID string, ...) v1alpha1.LighthouseJob
- func PeriodicSpec(p config.Periodic) v1alpha1.LighthouseJobSpec
- func PostsubmitSpec(p config.Postsubmit, refs v1alpha1.Refs) v1alpha1.LighthouseJobSpec
- func PresubmitSpec(p config.Presubmit, refs v1alpha1.Refs) v1alpha1.LighthouseJobSpec
- func ServePProf()
- type Filter
Constants ¶
This section is empty.
Variables ¶
var OkToTestRe = regexp.MustCompile(`(?m)^/(?:lh-)?ok-to-test\s*$`)
OkToTestRe provies the regex for `/ok-to-test`
var RetestRe = regexp.MustCompile(`(?m)^/(?:lh-)?retest\s*$`)
RetestRe provides the regex for `/retest`
var TestAllRe = regexp.MustCompile(`(?m)^/(?:lh-)?test all,?($|\s.*)`)
TestAllRe provides the regex for `/test all`
Functions ¶
func FilterPresubmits ¶
func FilterPresubmits(filter Filter, changes config.ChangedFilesProvider, branch string, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.Presubmit, error)
FilterPresubmits determines which presubmits should run and which should be skipped by evaluating the user-provided filter.
func JobURL ¶
JobURL returns the expected URL for LighthouseJobStatus.
TODO(fejta): consider moving default JobURLTemplate and JobURLPrefix out of plank
func LabelsAndAnnotationsForJob ¶
func LabelsAndAnnotationsForJob(lj v1alpha1.LighthouseJob, buildID string) (map[string]string, map[string]string)
LabelsAndAnnotationsForJob returns a standard set of labels to add to pod/build/etc resources.
func LabelsAndAnnotationsForSpec ¶
func LabelsAndAnnotationsForSpec(spec v1alpha1.LighthouseJobSpec, extraLabels, extraAnnotations map[string]string) (map[string]string, map[string]string)
LabelsAndAnnotationsForSpec returns a minimal set of labels to add to LighthouseJobs or its owned resources.
User-provided extraLabels and extraAnnotations values will take precedence over auto-provided values.
func LighthouseJobFields ¶
func LighthouseJobFields(pj *v1alpha1.LighthouseJob) logrus.Fields
LighthouseJobFields extracts logrus fields from a LighthouseJob useful for logging.
func NewLighthouseJob ¶
func NewLighthouseJob(spec v1alpha1.LighthouseJobSpec, extraLabels, extraAnnotations map[string]string) v1alpha1.LighthouseJob
NewLighthouseJob initializes a LighthouseJob out of a LighthouseJobSpec.
func NewPresubmit ¶
func NewPresubmit(pr *scm.PullRequest, baseSHA string, job config.Presubmit, eventGUID string, prRefFmt string) v1alpha1.LighthouseJob
NewPresubmit converts a config.Presubmit into a builder.PipelineOptions. The builder.Refs are configured correctly per the pr, baseSHA. The eventGUID becomes a gitprovider.EventGUID label.
func PeriodicSpec ¶
func PeriodicSpec(p config.Periodic) v1alpha1.LighthouseJobSpec
PeriodicSpec initializes a PipelineOptionsSpec for a given periodic job.
func PostsubmitSpec ¶
func PostsubmitSpec(p config.Postsubmit, refs v1alpha1.Refs) v1alpha1.LighthouseJobSpec
PostsubmitSpec initializes a PipelineOptionsSpec for a given postsubmit job.
func PresubmitSpec ¶
PresubmitSpec initializes a PipelineOptionsSpec for a given presubmit job.
func ServePProf ¶
func ServePProf()
ServePProf sets up a handler for pprof debug endpoints and starts a server for them asynchronously. The contents of this function are identical to what the `net/http/pprof` package does on import for the simple case where the default mux is to be used, but with a custom mux to ensure we don't serve this data from an exposed port.
Types ¶
type Filter ¶
Filter digests a presubmit config to determine if:
- we the presubmit matched the filter
- we know that the presubmit is forced to run
- what the default behavior should be if the presubmit runs conditionally and does not match trigger conditions
func AggregateFilter ¶
AggregateFilter builds a filter that evaluates the child filters in order and returns the first match
func CommandFilter ¶
CommandFilter builds a filter for `/test foo`
func PresubmitFilter ¶
func PresubmitFilter(honorOkToTest bool, contextGetter contextGetter, body string, logger *logrus.Entry) (Filter, error)
PresubmitFilter creates a filter for presubmits
func RetestFilter ¶
RetestFilter builds a filter for `/retest`
func TestAllFilter ¶
func TestAllFilter() Filter
TestAllFilter builds a filter for the automatic behavior of `/test all`. Pipelines that explicitly match `/test all` in their trigger regex will be handled by a commandFilter for the comment in question.