task

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 18 Imported by: 3

Documentation

Index

Constants

View Source
const PluginTypeTask plugin.Type = "task"

Variables

View Source
var CreateBaseStep = newBase

Functions

func NewCmdStepCfg added in v0.8.1

func NewCmdStepCfg() *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" yaml:"id"`
	Type            Type       `json:"type"            validate:"required" yaml:"type"`
	Steps           []*StepCfg `json:"steps"           validate:"required" 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 CmdStep added in v0.8.1

type CmdStep struct {
	Step
	*cmd.Cfg
	// contains filtered or unexported fields
}

func NewCmdStep

func NewCmdStep() *CmdStep

func (*CmdStep) GetCfg added in v0.8.1

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

func (*CmdStep) Init added in v0.8.1

func (c *CmdStep) Init() error

func (*CmdStep) Start added in v0.8.1

func (c *CmdStep) Start() error

func (*CmdStep) Stop added in v0.8.1

func (c *CmdStep) Stop() error

func (*CmdStep) Type added in v0.8.1

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

type Collector

type Collector func(*Task) interface{}

type FtpStep added in v0.8.1

type FtpStep struct {
	Step
	*FtpStepCfg
	// contains filtered or unexported fields
}

func NewFtpStep added in v0.8.1

func NewFtpStep() *FtpStep

func (*FtpStep) GetCfg added in v0.8.1

func (f *FtpStep) GetCfg() interface{}

func (*FtpStep) Init added in v0.8.1

func (f *FtpStep) Init() error

func (*FtpStep) Start added in v0.8.1

func (f *FtpStep) Start() error

func (*FtpStep) Stop added in v0.8.1

func (f *FtpStep) Stop() error

func (*FtpStep) Type added in v0.8.1

func (f *FtpStep) Type() interface{}

type FtpStepCfg added in v0.8.1

type FtpStepCfg struct {
	Addr    string `json:"addr"    yaml:"addr" validate:"required"`
	User    string `json:"user"    yaml:"user" validate:"required"`
	Pwd     string `json:"pwd"     yaml:"pwd"`
	Timeout int    `json:"timeout" yaml:"timeout"`
	Retry   int    `json:"retry"   yaml:"retry"`

	Cmd  string   `json:"cmd"     yaml:"cmd"     validate:"required"`
	Args []string `json:"args"    yaml:"args"`
}

func NewFtpStepCfg added in v0.8.1

func NewFtpStepCfg() *FtpStepCfg

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 PipelineStep added in v0.8.1

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

func NewPipelineStep added in v0.6.9

func NewPipelineStep() *PipelineStep

func (*PipelineStep) GetCfg added in v0.8.1

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

func (*PipelineStep) Init added in v0.8.1

func (p *PipelineStep) Init() error

func (*PipelineStep) Start added in v0.8.1

func (p *PipelineStep) Start() error

func (*PipelineStep) Stop added in v0.8.1

func (p *PipelineStep) Stop() error

func (*PipelineStep) Type added in v0.8.1

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

type Result added in v0.7.3

type Result struct {
	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 SSHStep added in v0.8.1

type SSHStep struct {
	Step
	*SSHStepCfg
	// contains filtered or unexported fields
}

func NewSSHStep added in v0.8.1

func NewSSHStep() *SSHStep

func (*SSHStep) GetCfg added in v0.8.1

func (s *SSHStep) GetCfg() interface{}

func (*SSHStep) Init added in v0.8.1

func (s *SSHStep) Init() error

func (*SSHStep) Start added in v0.8.1

func (s *SSHStep) Start() error

func (*SSHStep) Stop added in v0.8.1

func (s *SSHStep) Stop() error

func (*SSHStep) Type added in v0.8.1

func (s *SSHStep) Type() interface{}

type SSHStepCfg added in v0.8.1

type SSHStepCfg struct {
	Addr       string `json:"addr"       yaml:"addr" validate:"required"`
	User       string `json:"user"       yaml:"user" validate:"required"`
	Pwd        string `json:"pwd"        yaml:"pwd"  validate:"required"`
	PrivateKey string `json:"privateKey" yaml:"privateKey"`
	Timeout    int    `json:"timeout"    yaml:"timeout"`

	Cmd  string   `json:"cmd"  yaml:"cmd" validate:"required"`
	Args []string `json:"args" yaml:"args"`
}

func NewSSHStepCfg added in v0.8.1

func NewSSHStepCfg() *SSHStepCfg

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 StepTypeFtp StepType = "ftp"
const StepTypePipeline StepType = "pipeline"
const StepTypeSSH StepType = "ssh"

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)

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