Help us shape the future of Go! Take the 2026 Go Developer Survey

blocker

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const StatusPort = 8808

StatusPort is a default port for Blocker status

Variables

This section is empty.

Functions

func New

func New(c client.Client) *blocker

New creates a new blocker

Types

type Batch

type Batch struct {
	// PRs in the batch
	PRs []*PullRequest

	// Job is a IntegrationJob's namespaced name for the batch job
	Job types.NamespacedName

	// Processing is an indicator that the batch is under process
	Processing bool
}

Batch is a batch of PRs, waiting for a block-merge.

func (*Batch) Contains

func (b *Batch) Contains(id int) bool

Contains checks if a PR is in the batch

func (*Batch) Len

func (b *Batch) Len() int

Len is a length of the batch

type MergePool

type MergePool map[git.CommitStatusState]map[int]*PullRequest

MergePool is a pool for PRs. Keys are git.CommitStatusState (same as PullRequest.BlockerStatus) - pr.ID

func NewMergePool

func NewMergePool() MergePool

NewMergePool creates a new MergePool

func (MergePool) Add

func (m MergePool) Add(pr *PullRequest)

Add adds a PullRequest to the MergePool

func (MergePool) Delete

func (m MergePool) Delete(id int)

Delete deletes a given PR from the MergePool

func (MergePool) Search

func (m MergePool) Search(id int) *PullRequest

Search searches a given PR from the MergePool. Returns nil if it does not exist

type PRPool

type PRPool struct {

	// NamespacedName stores a name and a namespace of source IntegrationConfig
	types.NamespacedName

	// PullRequests store all open PullRequests for an IntegrationConfig, including those who does not meet conditions.
	PullRequests map[int]*PullRequest

	// MergePool is a cache of PRs which meet all the conditions except for commit status/merge conflict conditions
	MergePool MergePool

	// CurrentBatch is a batch of PRs, waiting for a block-merge.
	// If it's non-nil, maybe merger is retesting the PRs.
	CurrentBatch *Batch
	// contains filtered or unexported fields
}

PRPool is a PullRequest pool(=cache) of an IntegrationConfig

func NewPRPool

func NewPRPool(ns, name string) *PRPool

NewPRPool creates a new PRPool

type PullRequest

type PullRequest struct {
	git.PullRequest

	// BlockerStatus, BlockerDescription, and LatestSHA is for caching the commit status values
	// Only available statuses are pending and success - no failure/error
	BlockerStatus      git.CommitStatusState
	BlockerDescription string
	LatestSHA          string

	// Statuses stores whole commit statuses of the PR
	Statuses map[string]git.CommitStatus

	// Commits are the list of commits in the PR
	// Only set right before merging it, only if mergeConfig's commitTemplate is not empty
	Commits []git.Commit
	// contains filtered or unexported fields
}

PullRequest stores a raw git.PullRequest and a cache of the blocker's commit status

type PullRequestByID

type PullRequestByID []*PullRequest

PullRequestByID is a PR id, sorted by ID

func (PullRequestByID) Len

func (p PullRequestByID) Len() int

func (PullRequestByID) Less

func (p PullRequestByID) Less(i, j int) bool

func (PullRequestByID) Swap

func (p PullRequestByID) Swap(i, j int)

Jump to

Keyboard shortcuts

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