flowascode: github.com/sascha-andres/flowascode Index | Files

package flowascode

import "github.com/sascha-andres/flowascode"


Package Files

flow_execute.go flow_from_reader.go flow_from_yaml.go flow_get_default.go flow_get_env_with_variables.go flow_get_step.go flow_has_default.go flow_has_step.go flow_string.go flow_validate_step.go step_apply_text_template.go step_execute.go step_execute_other.go step_has_failure.go step_has_success.go step_string.go types.go


const ErrMissingFailureStep = Error("failure step not defined")
const ErrMissingStep = Error("step not defined")
const ErrMissingSuccessStep = Error("success step not defined")
const ErrNoScript = Error("no script in step")

func SetLogLevel Uses

func SetLogLevel(level logrus.Level)

SetLogLevel can be used to adjust the log level

type Descendant Uses

type Descendant struct {
    Name      string            `yaml:"name"`      // Name is the referenced step
    Variables map[string]string `yaml:"variables"` // Variables is a list of variables that are set as environment variables

Descendant represents on step after the current step that is it is a reference to a number of other steps

type Error Uses

type Error string

Error type for constant error definitions

func (Error) Error Uses

func (e Error) Error() string

type Flow Uses

type Flow struct {
    // BreakOnError bool   `yaml:"break_on_error"` // BreakOnError breaks if a script returns a non zero result
    Name        string `yaml:"name"`        // Name is a name for the flow
    Description string `yaml:"description"` // Description is a more descriptive text what the flow does
    Steps       []Step `yaml:"steps"`       // Steps is the collection of steps in the flow
    Shell       string `yaml:"shell"`       // Shell is the path or binary name for the shell to use to execute the script

Flow represents a complete flow

func NewFromReader Uses

func NewFromReader(reader io.Reader) (*Flow, error)

NewFromReader creates a Flow from a reader

func NewFromYAML Uses

func NewFromYAML(data string) (*Flow, error)

NewFromYAML takes a yaml string and creates a Flow object

func (*Flow) Execute Uses

func (f *Flow) Execute(name string, variables map[string]string) error

Execute takes a step name and starts to execute from there if no ma,e is given it tries to get the default namespace

func (*Flow) GetDefault Uses

func (f *Flow) GetDefault() (*Step, error)

GetDefault returns the default step

func (*Flow) GetStep Uses

func (f *Flow) GetStep(name string) (*Step, error)

GetStep returns the named step if found

func (*Flow) HasDefault Uses

func (f *Flow) HasDefault() bool

HasDefault returns true if there is a default step

A default step gets executed when no step is defined

func (*Flow) HasStep Uses

func (f *Flow) HasStep(name string) bool

HasStep returns true in case the step exists

func (Flow) String Uses

func (f Flow) String() string

String method is used to print values passed as an operand

func (*Flow) ValidateStep Uses

func (f *Flow) ValidateStep(name string) error

ValidateStep looks if a step could run successful

type Step Uses

type Step struct {
    Name      string       `yaml:"name"`       // Name of a step, also used to reference from C(Descendant)
    Script    []string     `yaml:"script"`     // Script to execute
    OnSuccess []Descendant `yaml:"on_success"` // OnSuccess is a list of steps to execute if the script returns with 0
    OnFailure []Descendant `yaml:"on_failure"` // OnFailure is a list of steps to execute if the scripts returns not a 0

Step is a single execution point in a flow

func (*Step) Execute Uses

func (s *Step) Execute(pathToShell string, variables []string) error

Execute is going to execute the script calls os specific implementations

func (*Step) HasFailure Uses

func (s *Step) HasFailure() bool

HasFailure returns true if there are further steps in case of a non successful run defined

func (*Step) HasSuccess Uses

func (s *Step) HasSuccess() bool

HasSuccess returns true if there are further steps in case of a successful run defined

func (Step) String Uses

func (s Step) String() string

String method is used to print values passed as an operand

Package flowascode imports 12 packages (graph). Updated 2019-06-25. Refresh now. Tools for package owners.