Version: v0.0.0-...-593f2af Latest Latest

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 29 Imported by: 5



Package tide contains a controller for managing a tide pool of PRs. The controller will automatically retest PRs in the pool and merge them if they pass tests.



This section is empty.


This section is empty.


This section is empty.


type Action

type Action string

Action represents what actions the controller can take. It will take exactly one action each sync.

const (
	Wait         Action = "WAIT"
	Trigger      Action = "TRIGGER"
	TriggerBatch Action = "TRIGGER_BATCH"
	Merge        Action = "MERGE"
	MergeBatch   Action = "MERGE_BATCH"
	PoolBlocked  Action = "BLOCKED"

Constants for various actions the controller might take

type CheckRun

type CheckRun struct {
	Name       githubql.String
	Conclusion githubql.String
	Status     githubql.String

type CheckRunNode

type CheckRunNode struct {
	CheckRun CheckRun `graphql:"... on CheckRun"`

type Commit

type Commit struct {
	Status            CommitStatus
	OID               githubql.String `graphql:"oid"`
	StatusCheckRollup StatusCheckRollup

Commit holds graphql data about commits and which contexts they have

type CommitNode

type CommitNode struct {
	Commit Commit

type CommitStatus

type CommitStatus struct {
	Contexts []Context

type Context

type Context struct {
	Context     githubql.String
	Description githubql.String
	State       githubql.StatusState

Context holds graphql response data for github contexts.

type Controller

type Controller struct {
	History *history.History
	// contains filtered or unexported fields

Controller knows how to sync PRs and PJs.

func NewController

func NewController(ghcSync, ghcStatus github.Client, mgr manager, cfg config.Getter, gc git.ClientFactory, maxRecordsPerPool int, opener io.Opener, historyURI, statusURI string, logger *logrus.Entry, usesGitHubAppsAuth bool) (*Controller, error)

NewController makes a Controller out of the given clients.

func (*Controller) ServeHTTP

func (c *Controller) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Controller) Shutdown

func (c *Controller) Shutdown()

Shutdown signals the statusController to stop working and waits for it to finish its last update loop before terminating. Controller.Sync() should not be used after this function is called.

func (*Controller) Sync

func (c *Controller) Sync() error

Sync runs one sync iteration.

type PRNode

type PRNode struct {
	PullRequest PullRequest `graphql:"... on PullRequest"`

type Pool

type Pool struct {
	Org    string
	Repo   string
	Branch string

	// PRs with passing tests, pending tests, and missing or failed tests.
	// Note that these results are rolled up. If all tests for a PR are passing
	// except for one pending, it will be in PendingPRs.
	SuccessPRs []PullRequest
	PendingPRs []PullRequest
	MissingPRs []PullRequest

	// Empty if there is no pending batch.
	BatchPending []PullRequest

	// Which action did we last take, and to what target(s), if any.
	Action   Action
	Target   []PullRequest
	Blockers []blockers.Blocker
	Error    string

	// All of the TenantIDs associated with PRs in the pool.
	TenantIDs []string

Pool represents information about a tide pool. There is one for every org/repo/branch combination that has PRs in the pool.

type PullRequest

type PullRequest struct {
	Number githubql.Int
	Author struct {
		Login githubql.String
	BaseRef struct {
		Name   githubql.String
		Prefix githubql.String
	HeadRefName githubql.String `graphql:"headRefName"`
	HeadRefOID  githubql.String `graphql:"headRefOid"`
	Mergeable   githubql.MergeableState
	Repository  struct {
		Name          githubql.String
		NameWithOwner githubql.String
		Owner         struct {
			Login githubql.String
	ReviewDecision githubql.PullRequestReviewDecision `graphql:"reviewDecision"`
	Commits        struct {
		Nodes []struct {
			Commit Commit
	} `graphql:"commits(last: 4)"`
	Labels struct {
		Nodes []struct {
			Name githubql.String
	} `graphql:"labels(first: 100)"`
	Milestone *struct {
		Title githubql.String
	Body      githubql.String
	Title     githubql.String
	UpdatedAt githubql.DateTime

PullRequest holds graphql data about a PR, including its commits and their contexts.

type StatusCheckRollup

type StatusCheckRollup struct {
	Contexts StatusCheckRollupContext `graphql:"contexts(last: 100)"`

type StatusCheckRollupContext

type StatusCheckRollupContext struct {
	Nodes []CheckRunNode


Path Synopsis
Package history provides an append only, size limited log of recent actions that Tide has taken for each subpool.
Package history provides an append only, size limited log of recent actions that Tide has taken for each subpool.

Jump to

Keyboard shortcuts

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