tide

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

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.

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.

Index

Constants

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

Constants for various actions the controller might take

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

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

type Commit

type Commit struct {
	Status struct {
		Contexts []Context
	}
	OID githubv4.String `graphql:"oid"`
}

Commit holds graphql data about commits and which contexts they have

type Context

type Context struct {
	Context     githubv4.String
	Description githubv4.String
	State       githubv4.StatusState
}

Context holds graphql response data for github contexts.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller knows how to sync PRs and PJs.

func NewController

func NewController(ghcSync, ghcStatus *github.Client, kc *kube.Client, ca *config.Agent, gc *git.Client, logger *logrus.Entry) *Controller

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 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
}

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 githubv4.Int
	Author struct {
		Login githubv4.String
	}
	BaseRef struct {
		Name   githubv4.String
		Prefix githubv4.String
	}
	HeadRefName githubv4.String `graphql:"headRefName"`
	HeadRefOID  githubv4.String `graphql:"headRefOid"`
	Mergeable   githubv4.MergeableState
	Repository  struct {
		Name          githubv4.String
		NameWithOwner githubv4.String
		Owner         struct {
			Login githubv4.String
		}
	}
	Commits struct {
		Nodes []struct {
			Commit Commit
		}
	} `graphql:"commits(last: 4)"`
	Labels struct {
		Nodes []struct {
			Name githubv4.String
		}
	} `graphql:"labels(first: 100)"`
	Milestone *struct {
		Title githubv4.String
	}
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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