codereview

package
v0.0.0-...-e0ff526 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: BSD-3-Clause Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// GitHubPRDurationForChecks is the duration after a PR is created that
	// checks should be looked at.
	GitHubPRDurationForChecks = time.Minute * 15
)

Variables

View Source
var (
	// Create exponential backoff config to use for Github calls.
	//
	// The below example demonstrates what a series of
	// retries will look like. retry_interval is 10 seconds,
	// randomization_factor is 0.5, multiplier is 2 and the max_interval is 3
	// minutes. For 5 tries the sequence will be (values in seconds) and
	// assuming we go over the max_elapsed_time on the 5th try:
	//
	//  attempt#      retry_interval      randomized_interval
	//  1              10                 [5,   15]
	//  2              20                 [10,  30]
	//  3              40                 [20,  60]
	//  4              60                 [30,  90]
	//  5             120                 backoff.Stop
	GithubBackOffConfig = &backoff.ExponentialBackOff{
		InitialInterval:     10 * time.Second,
		RandomizationFactor: 0.5,
		Multiplier:          2,
		MaxInterval:         3 * time.Minute,
		MaxElapsedTime:      5 * time.Minute,
		Clock:               backoff.SystemClock,
	}
)

Functions

This section is empty.

Types

type CodeReview

type CodeReview interface {
	// GetIssueUrlBase returns a base URL which can be used to construct
	// URLs for individual issues.
	GetIssueUrlBase() string

	// GetFullHistoryUrl returns a url that contains all changes uploaded by
	// the user.
	GetFullHistoryUrl() string

	// RetrieveRoll retrieves a RollImpl corresponding to the given issue.
	// The passed-in AutoRollIssue becomes owned by the RollImpl; it may
	// modify it, insert it into the RecentRolls DB, etc.
	// TODO(borenet): Consider storing the rollingTo Revision as part of the
	// autoroll.AutoRollIssue struct, to avoid passing it around.
	RetrieveRoll(context.Context, *autoroll.AutoRollIssue, *recent_rolls.RecentRolls, *revision.Revision, *revision.Revision, func(context.Context, RollImpl) error) (RollImpl, error)

	// UserEmail returns the email address of the authenticated user.
	UserEmail() string

	// UserName returns the name of the authenticated user.
	UserName() string

	// Client returns the API client used to interact with this CodeReview.
	Client() interface{}
}

CodeReview outlines the autoroller's interaction with a code review system.

func NewGerrit

func NewGerrit(cfg *config.GerritConfig, gerritClient gerrit.GerritInterface, client *http.Client) (CodeReview, error)

NewGerrit returns a gerritCodeReview instance.

func NewGitHub

func NewGitHub(cfg *config.GitHubConfig, githubClient *github.GitHub) (CodeReview, error)

NewGitHub returns a githubCodeReview instance.

type CodeReviewConfig

type CodeReviewConfig interface {
	util.Validator
}

CodeReviewConfig provides generalized configuration information for a code review service.

type RollImpl

type RollImpl interface {
	state_machine.RollCLImpl

	// Insert the roll into the DB.
	InsertIntoDB(ctx context.Context) error
}

RollImpl describes the behavior of an autoroll CL.

Jump to

Keyboard shortcuts

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