trigger

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterPresubmits

func FilterPresubmits(honorOkToTest bool, scmClient SCMProviderClient, body string, pr *scm.PullRequest, presubmits []job.Presubmit, logger *logrus.Entry) ([]job.Presubmit, []job.Presubmit, error)

FilterPresubmits determines which presubmits should run. We only want to trigger jobs that should run, but the pool of jobs we filter to those that should run depends on the type of trigger we just got:

  • if we get a /test foo, we only want to consider those jobs that match; jobs will default to run unless we can determine they shouldn't
  • if we got a /retest, we only want to consider those jobs that have already run and posted failing contexts to the PR or those jobs that have not yet run but would otherwise match /test all; jobs will default to run unless we can determine they shouldn't
  • if we got a /test all or an /ok-to-test, we want to consider any job that doesn't explicitly require a human trigger comment; jobs will default to not run unless we can determine that they should

If a comment that we get matches more than one of the above patterns, we consider the set of matching presubmits the union of the results from the matching cases.

func HonorOkToTest

func HonorOkToTest(trigger *plugins.Trigger) bool

HonorOkToTest checks if shoudn't ignore the ok test

func RunAndSkipJobs

func RunAndSkipJobs(c Client, pr *scm.PullRequest, requestedJobs []job.Presubmit, skippedJobs []job.Presubmit, eventGUID string, elideSkippedContexts bool) error

RunAndSkipJobs executes the config.Presubmits that are requested and posts skipped statuses for the reporting jobs that are skipped

func TrustedOrDraftPullRequest added in v1.15.0

func TrustedOrDraftPullRequest(spc scmProviderClient, trigger *plugins.Trigger, author, org, repo string, num int, isDraft bool, l []*scm.Label) ([]*scm.Label, bool, error)

TrustedOrDraftPullRequest returns whether or not the given PR should be tested. It first checks if the author is in the org, then looks for "ok-to-test" label.

func TrustedUser

func TrustedUser(spc trustedUserClient, trigger *plugins.Trigger, user, org, repo string) (bool, error)

TrustedUser returns true if user is trusted in repo.

Trusted users are either repo collaborators, org members, trusted org members or trusted Github Apps. Whether repo collaborators and/or a second org is trusted is configured by trigger.

Types

type Client

type Client struct {
	SCMProviderClient scmProviderClient
	LauncherClient    launcher
	Config            *config.Config
	Logger            *logrus.Entry
}

Client holds the necessary structures to work with prow via logging, github, kubernetes and its configuration.

TODO(fejta): consider exporting an interface rather than a struct

type PeriodicAgent added in v1.16.0

type PeriodicAgent struct {
	Namespace string
	SCMClient *scm.Client
}

func (*PeriodicAgent) InitializePeriodics added in v1.16.0

func (pa *PeriodicAgent) InitializePeriodics(kc kubeclient.Interface, configAgent *config.Agent, fileBrowsers *filebrowser.FileBrowsers)

func (*PeriodicAgent) PeriodicsInitialized added in v1.16.0

func (pa *PeriodicAgent) PeriodicsInitialized(namespace string, kc kubeclient.Interface) bool

func (*PeriodicAgent) UpdatePeriodics added in v1.16.0

func (pa *PeriodicAgent) UpdatePeriodics(kc kubeclient.Interface, agent plugins.Agent, pe *scm.PushHook)

func (*PeriodicAgent) UpdatePeriodicsForRepo added in v1.16.0

func (pa *PeriodicAgent) UpdatePeriodicsForRepo(
	periodics []job.Periodic,
	l *logrus.Entry,
	getExistingConfigMap func(p job.Periodic) *corev1.ConfigMap,
	getExistingCron func(p job.Periodic) *batchv1.CronJob,
	org string,
	repo string,
	cmInterface typedv1.ConfigMapInterface,
	cjInterface typedbatchv1.CronJobInterface,
) bool

type SCMProviderClient

type SCMProviderClient interface {
	GetCombinedStatus(org, repo, ref string) (*scm.CombinedStatus, error)
	GetPullRequestChanges(org, repo string, number int) ([]*scm.Change, error)
}

SCMProviderClient Github client

Jump to

Keyboard shortcuts

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