controller

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildFail = errors.New("build failed")

Functions

func Expand

func Expand(task config.Task, params Params) ([]config.Task, error)

Types

type Controller

type Controller struct {
	GitHub     GitHub
	Config     config.Config
	Executor   Executor
	FileReader FileReader
	FileWriter FileWriter
	Timer      Timer
	Stdout     io.Writer
	Stderr     io.Writer
}

func (Controller) ReadExternalFiles added in v0.5.0

func (ctrl Controller) ReadExternalFiles(ctx context.Context, wd string) error

func (Controller) Run

func (ctrl Controller) Run(ctx context.Context, wd string) error

type EventQueue

type EventQueue struct {
	Queue chan struct{}
	// contains filtered or unexported fields
}

func (*EventQueue) Close

func (queue *EventQueue) Close()

func (*EventQueue) Pop

func (queue *EventQueue) Pop()

func (*EventQueue) Push

func (queue *EventQueue) Push()

type Executor

type Executor interface {
	Run(ctx context.Context, params execute.Params) (domain.CommandResult, error)
}

type Expr

type Expr interface {
	Match(params interface{}) (bool, error)
}

type FileReader

type FileReader interface {
	Read(path string) (domain.FileResult, error)
}

type FileWriter added in v0.4.0

type FileWriter interface {
	Write(path, text string) (domain.FileResult, error)
}

type GitHub

type GitHub interface {
	GetPR(ctx context.Context, params gh.ParamsGetPR) (*github.PullRequest, *github.Response, error)
	GetPRFiles(ctx context.Context, params gh.ParamsGetPRFiles) ([]*github.CommitFile, *github.Response, error)
	ListPRsWithCommit(ctx context.Context, params gh.ParamsListPRsWithCommit) ([]*github.PullRequest, *github.Response, error)
}

type Params

type Params struct {
	PR        interface{}
	Files     interface{}
	Phases    map[string]Phase
	TaskIdx   int
	PhaseName string
	Item      config.Item
	Meta      map[string]interface{}
}

func (Params) ToExpr

func (params Params) ToExpr() map[string]interface{}

func (Params) ToTemplate

func (params Params) ToTemplate() map[string]interface{}

type Phase

type Phase struct {
	Config     config.Phase
	EventQueue *EventQueue
	Stdout     io.Writer
	Stderr     io.Writer
	TaskQueue  TaskQueue
	Status     string
	Error      error
	Exit       bool
	Tasks      *TaskList
}

func (*Phase) Get

func (phase *Phase) Get(name string) []Task

func (*Phase) IsReady added in v0.4.0

func (phase *Phase) IsReady(task Task, params Params) (bool, error)

func (Phase) Meta added in v0.4.0

func (phase Phase) Meta() map[string]interface{}

func (Phase) Name added in v0.4.0

func (phase Phase) Name() string

func (*Phase) PrepareCommandTask added in v0.5.0

func (phase *Phase) PrepareCommandTask(task Task, params Params, wd string) (Task, error)

func (*Phase) PrepareTask added in v0.4.0

func (phase *Phase) PrepareTask(task Task, params Params, wd string) (Task, error)

func (*Phase) Run

func (phase *Phase) Run(ctx context.Context, params Params, wd string) error

func (*Phase) RunTask

func (phase *Phase) RunTask(ctx context.Context, idx int, task Task, params Params, wd string) error

func (Phase) ToTemplate added in v0.4.0

func (phase Phase) ToTemplate() map[string]interface{}

type Task

type Task struct {
	Result     domain.Result
	Config     config.Task
	Executor   Executor
	FileReader FileReader
	FileWriter FileWriter
	Timer      Timer
	Stdout     io.Writer
	Stderr     io.Writer
}

func (Task) Name added in v0.4.0

func (task Task) Name() string

func (Task) Run

func (task Task) Run(ctx context.Context, wd string) (domain.Result, error)

func (Task) ToTemplate

func (task Task) ToTemplate() map[string]interface{}

type TaskList added in v0.4.0

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

func (*TaskList) Get added in v0.4.0

func (list *TaskList) Get(idx int) Task

func (*TaskList) GetAll added in v0.4.0

func (list *TaskList) GetAll() []Task

func (*TaskList) Set added in v0.4.0

func (list *TaskList) Set(idx int, task Task)

func (*TaskList) Size added in v0.4.0

func (list *TaskList) Size() int

type TaskQueue

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

type Timer

type Timer interface {
	Now() time.Time
}

Jump to

Keyboard shortcuts

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