task

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const PluginTypeTask plugin.Type = "task"

Variables

View Source
var CreateBaseStep = newBase

Functions

func NewCmdCfg

func NewCmdCfg() *cmd.Cfg

func NewPipelineCfg added in v0.6.9

func NewPipelineCfg() *pipeline.Cfg

Types

type Cfg

type Cfg struct {
	ID              string     `json:"id"              validate:"required,min=1" yaml:"id"`
	Type            Type       `json:"type"            validate:"required"       yaml:"type"`
	Steps           []*StepCfg `json:"steps"           validate:"required,min=1" yaml:"steps"`
	DeferSteps      []*StepCfg `json:"deferSteps"      yaml:"deferSteps"`
	CurStepIdx      int        `json:"curStepIdx"      yaml:"curStepIdx"`
	CurDeferStepIdx int        `json:"curDeferStepIdx" yaml:"curDeferStepIdx"`
}

func NewCfg

func NewCfg() *Cfg

func (*Cfg) Add

func (c *Cfg) Add(typ StepType, cfg interface{}) *Cfg

func (*Cfg) Defer

func (c *Cfg) Defer(typ StepType, cfg interface{}) *Cfg

func (*Cfg) SetID

func (c *Cfg) SetID(id string) *Cfg

func (*Cfg) SetType

func (c *Cfg) SetType(t Type) *Cfg

type Cmd

type Cmd struct {
	Step
	*cmd.Cfg
}

func NewCmdStep

func NewCmdStep() *Cmd

func (*Cmd) GetCfg

func (c *Cmd) GetCfg() interface{}

func (*Cmd) Init

func (c *Cmd) Init() error

func (*Cmd) Start

func (c *Cmd) Start() error

func (*Cmd) Stop

func (c *Cmd) Stop() error

func (*Cmd) Type

func (c *Cmd) Type() interface{}

type Collector

type Collector func(*Task) interface{}

type Hook added in v0.7.1

type Hook func(*Task, error, *HookExtraData)

type HookExtraData added in v0.7.1

type HookExtraData struct {
	Submitted  bool
	SubmitWait bool
}

type Pipeline added in v0.6.9

type Pipeline struct {
	Step
	*pipeline.Cfg
	// contains filtered or unexported fields
}

func NewPipelineStep added in v0.6.9

func NewPipelineStep() *Pipeline

func (*Pipeline) GetCfg added in v0.6.9

func (p *Pipeline) GetCfg() interface{}

func (*Pipeline) Init added in v0.6.9

func (p *Pipeline) Init() error

func (*Pipeline) Start added in v0.6.9

func (p *Pipeline) Start() error

func (*Pipeline) Stop added in v0.6.9

func (p *Pipeline) Stop() error

func (*Pipeline) Type added in v0.6.9

func (p *Pipeline) Type() interface{}

type Result added in v0.7.3

type Result struct {
	Cfg            *Cfg                     `json:"cfg"            yaml:"cfg"`
	Data           map[string]interface{}   `json:"data"           yaml:"data"`
	StepsData      []map[string]interface{} `json:"stepsData"      yaml:"stepsData"`
	DeferStepsData []map[string]interface{} `json:"deferStepsData" yaml:"deferStepsData"`
}

type Step

type Step interface {
	runner.Runner
	plugin.Plugin
	GetTask() *Task
	SetTask(*Task)
}

type StepCfg

type StepCfg struct {
	Type StepType    `json:"type" validate:"required" yaml:"type"`
	Cfg  interface{} `json:"cfg"  validate:"required" yaml:"cfg"`
}

type StepHook added in v0.7.1

type StepHook func(*Task, int, Step)

type StepType

type StepType string
const StepTypeCmd StepType = "cmd"
const StepTypePipeline StepType = "pipeline"

type Task

type Task struct {
	runner.Runner
	plugin.Plugin
	*Cfg
	// contains filtered or unexported fields
}

func New

func New() *Task

func (*Task) CurDeferStep

func (t *Task) CurDeferStep() Step

func (*Task) CurStep

func (t *Task) CurStep() Step

func (*Task) DeferSteps

func (t *Task) DeferSteps() []Step

func (*Task) GetCfg added in v0.0.3

func (t *Task) GetCfg() interface{}

func (*Task) Init

func (t *Task) Init() error

func (*Task) RegisterCollector added in v0.3.9

func (t *Task) RegisterCollector(c Collector)

func (*Task) RegisterDeferStepDoneHook

func (t *Task) RegisterDeferStepDoneHook(hook ...StepHook)

func (*Task) RegisterStepDoneHook

func (t *Task) RegisterStepDoneHook(hook ...StepHook)

func (*Task) Result

func (t *Task) Result() interface{}

func (*Task) Start

func (t *Task) Start() error

func (*Task) Steps

func (t *Task) Steps() []Step

func (*Task) Stop

func (t *Task) Stop() error

func (*Task) Store added in v0.0.3

func (t *Task) Store(k string, v any) error

func (*Task) Type added in v0.0.3

func (t *Task) Type() interface{}

type Type

type Type string

Jump to

Keyboard shortcuts

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