Documentation ¶
Index ¶
- Constants
- func FilterPresubmits(honorOkToTest bool, scmClient SCMProviderClient, body string, ...) ([]config.Presubmit, []config.Presubmit, error)
- func HonorOkToTest(trigger *plugins.Trigger) bool
- func RunAndSkipJobs(c Client, pr *scm.PullRequest, requestedJobs []config.Presubmit, ...) error
- func TrustedPullRequest(spc scmProviderClient, trigger *plugins.Trigger, author, org, repo string, ...) ([]*scm.Label, bool, error)
- func TrustedUser(spc trustedUserClient, trigger *plugins.Trigger, user, org, repo string) (bool, error)
- type Client
- type SCMProviderClient
Constants ¶
const (
// PluginName is the name of the trigger plugin
PluginName = "trigger"
)
Variables ¶
This section is empty.
Functions ¶
func FilterPresubmits ¶
func FilterPresubmits(honorOkToTest bool, scmClient SCMProviderClient, body string, pr *scm.PullRequest, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.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 ¶
HonorOkToTest checks if shoudn't ignore the ok test
func RunAndSkipJobs ¶
func RunAndSkipJobs(c Client, pr *scm.PullRequest, requestedJobs []config.Presubmit, skippedJobs []config.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 TrustedPullRequest ¶
func TrustedPullRequest(spc scmProviderClient, trigger *plugins.Trigger, author, org, repo string, num int, l []*scm.Label) ([]*scm.Label, bool, error)
TrustedPullRequest 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 or trusted org members. 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