prbuild

package module
v0.0.0-...-0c155dc Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: GPL-3.0 Imports: 20 Imported by: 1

README

ali-prbuild

ALICE Golang Pull Request Builder

Documentation

Index

Constants

View Source
const (
	// TaskName is the name of this task
	TaskName = "prbuild"

	// TaskDesc describes succintly what this task does
	TaskDesc = "Builds Github pull requests"
)

Variables

View Source
var (
	Debug = logging.Debug
	Info  = logging.Info
	Error = logging.Error
	Field = logging.F

	ErrField = func(e error) logging.Field {
		return logging.F("err", e)
	}
)

Logging shortcuts for the package

Functions

func BuildAlreadyStartedError

func BuildAlreadyStartedError(startTime int64) *buildAlreadyStarted

func BuildNotRunningError

func BuildNotRunningError() *buildNotRunningError

func BuildOngoingError

func BuildOngoingError(pr int) *buildOngoingError

func NewBuildLogs

func NewBuildLogs(logsRootDir, develPrefix string) *buildLogs

func NoBuildToStopError

func NoBuildToStopError() *noBuildToStopError

func NothingToBuildError

func NothingToBuildError(msg string) *nothingToBuildError

Types

type Build

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

Build wraps the instructions for building a pull request

func NewBuild

func NewBuild(pr *pullrequest.PR) *Build

NewBuild creates a Build instance for the given pull request func NewBuild(pr *pullrequest.PR) *Build {

func (*Build) Done

func (b *Build) Done() bool

Done indicates if the given build has finished

func (*Build) Error

func (b *Build) Error() error

func (*Build) HasError

func (b *Build) HasError() bool

HasError checks if the build has an error

func (*Build) Running

func (b *Build) Running() bool

func (*Build) SetDone

func (b *Build) SetDone()

SetDone

type Builder

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

Builder is the type that manages building of pull requests

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a builder that oversees the building of pull requests

func (*Builder) Start

func (b *Builder) Start(pr *pullrequest.PR) error

Start will launch aliBuild on the given pull request. If a build is already ongoing, a BuildOngoingError is returned.

func (*Builder) Stop

func (b *Builder) Stop() error

Stop shut downs the ongoing pull request build

type CodeBuilder

type CodeBuilder interface {
	Clean(bool)
	Doctor()
	Build()
	HasFetchReposOption() bool
}

type Fetcher

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

Fetcher fetches PRs in a goroutine, and pushes them onto its prs channel

func NewFetcher

func NewFetcher() *Fetcher

NewFetcher constructs a Fetcher type

func (*Fetcher) Data

func (f *Fetcher) Data() *priorityPRData

func (*Fetcher) Done

func (f *Fetcher) Done() <-chan struct{}

func (*Fetcher) IsRunning

func (f *Fetcher) IsRunning() bool

func (*Fetcher) Start

func (f *Fetcher) Start()

Start launches a goroutine, fetching pull requests until told to stop on the Fetcher shutdown channel. Fetched pull requests are pushed on to the Fetcher prs channel and retrieved via the Data() method.

func (*Fetcher) Stop

func (f *Fetcher) Stop() error

Stop will set the Fetcher shutdown channel

type FetcherCounts

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

FetcherCounts holds on to useful counts info related to PR fetching

type FetcherTimes

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

FetcherTimes holds on to useful timing info related to PR fetching

type Metric

type Metric struct {
	Name  string
	Path  string
	Value interface{}
}

Metric represents a metric to send

type ShutdownError

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

ShutdownError represents the error returned if an abort request is made

type Task

type Task struct {
	task.Task
	// contains filtered or unexported fields
}

Task is the main data structure for this pull request building task

func NewTask

func NewTask() *Task

NewTask constructs a new prbuild task and returns it

func (Task) Exec

func (t Task) Exec(ctx context.Context)

Exec performs the meat of the pull request building activity It will exit if an external task abort is detected (the done channel is then closed), if the context is cancelled or if the task decides to stop running for now (because no pull requests have been available in the past N minutes)

func (*Task) FindWork

func (t *Task) FindWork(ctx context.Context)

FindWork checks if the task has work it could do, and updates the HaveWork boolean attribute accordingly It is run during state Seek. It will abort its action if the context is cancelled.

func (Task) PreExec

func (t Task) PreExec(ctx context.Context)

PreExec runs setup code before the real task run

func (*Task) Stop

func (t *Task) Stop()

Stop will shut down the spawned fetcher and builder routines

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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