engine

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllBuilders enumerates all builders known to the system.

AllRunners enumerates all runners known to the system.

Functions

func UnmarshalTask added in v0.6.0

func UnmarshalTask(taskData []byte) (*task.Task, error)

UnmarshalTask converts the given byte array into a valid task

Types

type BuildInput added in v0.6.0

type BuildInput struct {
	*api.BuildRequest
	Sources *api.UnpackedSources
}

type Engine

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

Engine is the central runtime object of the system. It knows about all test plans, builders, and runners. It is supposed to be instantiated as a singleton in all runtimes, whether the testground is run as a CLI tool, or as a daemon. In the latter mode, the GitHub bridge will trigger commands and perform queries on the Engine.

TODO: the Engine should also centralise all system state and make it queryable, e.g. what tests are running, or have run, such that we can easily query test plans that ran for a particular commit of an upstream.

func NewDefaultEngine

func NewDefaultEngine(ecfg *config.EnvConfig) (*Engine, error)

func NewEngine

func NewEngine(cfg *EngineConfig) (*Engine, error)

func (*Engine) BuilderByName

func (e *Engine) BuilderByName(name string) (api.Builder, bool)

func (*Engine) Context

func (e *Engine) Context() context.Context

func (*Engine) DeleteTask added in v0.6.0

func (e *Engine) DeleteTask(id string) error

DeleteTask removes a task from the Testground daemon database

func (*Engine) DoBuildPurge added in v0.5.3

func (e *Engine) DoBuildPurge(ctx context.Context, builder, plan string, ow *rpc.OutputWriter) error

func (*Engine) DoCollectOutputs

func (e *Engine) DoCollectOutputs(ctx context.Context, runID string, ow *rpc.OutputWriter) error

func (*Engine) DoHealthcheck

func (e *Engine) DoHealthcheck(ctx context.Context, runner string, fix bool, ow *rpc.OutputWriter) (*api.HealthcheckReport, error)

func (*Engine) DoTerminate

func (e *Engine) DoTerminate(ctx context.Context, ctype api.ComponentType, ref string, ow *rpc.OutputWriter) error

func (*Engine) EnvConfig

func (e *Engine) EnvConfig() config.EnvConfig

EnvConfig returns the EnvConfig for this Engine.

func (*Engine) GetTask added in v0.6.0

func (e *Engine) GetTask(id string) (*task.Task, error)

func (*Engine) Kill added in v0.6.0

func (e *Engine) Kill(id string) error

Kill closes the signal channel for a given task, which signals to the runner to stop it

func (*Engine) ListBuilders

func (e *Engine) ListBuilders() map[string]api.Builder

func (*Engine) ListRunners

func (e *Engine) ListRunners() map[string]api.Runner

func (*Engine) Logs added in v0.6.0

func (e *Engine) Logs(ctx context.Context, id string, follow bool, cancel bool, w io.Writer) (*task.Task, error)

Logs writes the Testground daemon logs for a given task to the passed writer. It is used when using the `--follow` option with `testground run`

func (*Engine) QueueBuild added in v0.6.0

func (e *Engine) QueueBuild(request *api.BuildRequest, sources *api.UnpackedSources) (string, error)

func (*Engine) QueueRun added in v0.6.0

func (e *Engine) QueueRun(request *api.RunRequest, sources *api.UnpackedSources) (string, error)

func (*Engine) RunnerByName

func (e *Engine) RunnerByName(name string) (api.Runner, bool)

func (*Engine) Tasks added in v0.6.0

func (e *Engine) Tasks(filters api.TasksFilters) ([]task.Task, error)

Tasks returns a list of tasks that match the filters argument

type EngineConfig

type EngineConfig struct {
	Builders  []api.Builder
	Runners   []api.Runner
	EnvConfig *config.EnvConfig
}

type RunInput added in v0.6.0

type RunInput struct {
	*api.RunRequest
	Sources *api.UnpackedSources
}

type TaskExecutionError added in v0.6.0

type TaskExecutionError struct {
	TaskType   string
	WrappedErr error
}

func (*TaskExecutionError) Error added in v0.6.0

func (e *TaskExecutionError) Error() string

Jump to

Keyboard shortcuts

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