task

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	Commands     []string // Commands to run
	Context      string
	Env          variables.Container
	Variables    variables.Container
	Variations   []map[string]string
	Dir          string
	Timeout      *time.Duration
	AllowFailure bool
	After        []string
	Before       []string
	Interactive  bool
	// ResetContext is useful if multiple variations are running in the same task
	ResetContext bool
	Condition    string
	Skipped      bool

	Name        string
	Description string

	Start time.Time
	End   time.Time

	ExportAs string

	ExitCode int16
	Errored  bool
	Error    error
	Log      struct {
		Stderr *bytes.Buffer
		Stdout *bytes.Buffer
	}
}

Task is a structure that describes task, its commands, environment, working directory etc. After task completes it provides task's execution status, exit code, stdout and stderr

func FromCommands

func FromCommands(name string, commands ...string) *Task

FromCommands creates task new Task instance with given commands

func NewTask

func NewTask(name string) *Task

NewTask creates new Task instance

func (*Task) Duration

func (t *Task) Duration() time.Duration

Duration returns task's execution duration

func (*Task) ErrorMessage

func (t *Task) ErrorMessage() string

ErrorMessage returns message of the error occurred during task execution

func (*Task) GetVariations

func (t *Task) GetVariations() []map[string]string

GetVariations returns array of maps which are task's variations

func (*Task) Output

func (t *Task) Output() string

Output returns task's stdout as a string

func (*Task) WithEnv

func (t *Task) WithEnv(key, value string) *Task

WithEnv sets environment variable

Jump to

Keyboard shortcuts

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