workflow

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderTemplate added in v0.3.0

func RenderTemplate(templateID, templateData string, devices []byte) (string, error)

RenderTemplate renders the workflow template with regard to the given hardware details.

Types

type Action

type Action struct {
	Name        string            `yaml:"name"`
	Image       string            `yaml:"image"`
	Timeout     int64             `yaml:"timeout"`
	Command     []string          `yaml:"command,omitempty"`
	OnTimeout   []string          `yaml:"on-timeout,omitempty"`
	OnFailure   []string          `yaml:"on-failure,omitempty"`
	Volumes     []string          `yaml:"volumes,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
	Pid         string            `yaml:"pid,omitempty"`
}

Action is the basic executional unit for a workflow.

type Task

type Task struct {
	Name        string            `yaml:"name"`
	WorkerAddr  string            `yaml:"worker"`
	Actions     []Action          `yaml:"actions"`
	Volumes     []string          `yaml:"volumes,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
}

Task represents a task to be executed as part of a workflow.

type Workflow

type Workflow struct {
	Version       string `yaml:"version"`
	Name          string `yaml:"name"`
	ID            string `yaml:"id"`
	GlobalTimeout int    `yaml:"global_timeout"`
	Tasks         []Task `yaml:"tasks"`
}

Workflow represents a workflow to be executed.

func MustParse added in v0.3.0

func MustParse(yamlContent []byte) *Workflow

MustParse parse a slice of bytes to a template. It an error occurs the function triggers a panic. Common utility for testing purpose.

func MustParseFromFile added in v0.3.0

func MustParseFromFile(path string) *Workflow

MustParseFromFile parse a template from a file and it panics if any error is detected. Ideal to be used in testing.

func Parse

func Parse(yamlContent []byte) (*Workflow, error)

Parse parses the template yaml content into a Workflow.

func RenderTemplateHardware added in v0.7.0

func RenderTemplateHardware(templateID, templateData string, hardware map[string]interface{}) (*Workflow, *bytes.Buffer, error)

RenderTemplateHardware renders the workflow template and returns the Workflow and the interpolated bytes.

Jump to

Keyboard shortcuts

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