config

package
v0.0.0-...-817c61a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT Imports: 10 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// SubTagGood the tag to be used on events who's result is good
	SubTagGood = "good"
	// SubTagBad the tag to be used on events who's result is bad
	SubTagBad = "bad"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Common commonConfig
	// the list of flow configurations
	Flows []*Flow
}

Config is the set of nodes and rules

func ParseYAML

func ParseYAML(in []byte) (*Config, error)

ParseYAML takes a YAML input as a byte array and returns a Config object or an error

func (*Config) Defaults

func (c *Config) Defaults()

Defaults ensures some sensible defaults have been set up

func (*Config) FindFlowsByTriggers

func (c *Config) FindFlowsByTriggers(triggerType string, flow FlowRef, opts nt.Opts) map[FlowRef]FoundFlow

FindFlowsByTriggers finds all flows where its subs match the given params

func (*Config) Flow

func (c *Config) Flow(fRef FlowRef) *Flow

Flow returns the flow config matching the id and version

func (*Config) LatestFlow

func (c *Config) LatestFlow(id string) *Flow

LatestFlow returns the flow config matching the id with the highest version

type Flow

type Flow struct {
	ID  string // url friendly ID - computed from the name if not given
	Ver int    // flow version, together with an ID form a global compound unique key

	// FlowFile is a path to a config file describing the Tasks.
	// It can be a path to a file in a git repo e.g. git@github.com:floeit/floe.git/build/FLOE.yaml
	// or a local file e.g. file:./foo-bar/floe.yaml
	// a FlowFile may override any setting from the flows defined in the main config file, but it
	// does not make much sense that they override the Triggers.
	FlowFile string `yaml:"flow-file"`

	Name         string   // human friendly name
	ReuseSpace   bool     `yaml:"reuse-space"`   // if true then will use the single workspace and will mutex with other instances of this Flow
	HostTags     []string `yaml:"host-tags"`     // tags that must match the tags on the host
	ResourceTags []string `yaml:"resource-tags"` // tags that if any flow is running with any matching tags then don't launch
	Env          []string // key=value environment variables with

	// Triggers are the node types that define how a run is triggered for this flow.
	Triggers []*node

	// The things to do once a trigger has started this flow
	Tasks []*node
}

Flow is a serialisable Flow Config, a definition of a flow. It is uniquely identified by an ID and Version.

func (*Flow) Graph

func (f *Flow) Graph() (lvs [][]string, problems []string)

Graph returns an array representing levels in the flow 0 being the trigger events and the end events having the highest number

func (*Flow) Load

func (f *Flow) Load(cacheDir string) (err error)

Load looks at the FlowFile and loads in the flow from that reference overriding any pre-existing settings, except triggers.

func (*Flow) MatchTag

func (f *Flow) MatchTag(tag string) []*node

MatchTag finds all nodes that are waiting for this event tag

func (*Flow) Node

func (f *Flow) Node(id string) *node

Node returns the node matching id

type FlowRef

type FlowRef struct {
	ID  string
	Ver int
}

FlowRef is a reference that uniquely identifies a flow

func (FlowRef) Equal

func (f FlowRef) Equal(g FlowRef) bool

Equal returns true if all fields in f anf g are equal

func (FlowRef) NonZero

func (f FlowRef) NonZero() bool

NonZero returns true if this ref has been assigned nonzero values

func (FlowRef) String

func (f FlowRef) String() string

type FoundFlow

type FoundFlow struct {
	// Ref constructed from the Flow
	Ref FlowRef
	// Matched is whatever node cause this flow to be found. It is either the trigger node that
	// matched the criteria to have found the flow and node, or a list of nodes that matched the
	// event that
	Matched *node
	// the full Flow definition
	*Flow
}

FoundFlow is a struct containing a Flow and trigger that matched this flow. It can be used to decide on the best host to use to run this Flow.

type NodeClass

type NodeClass string

NodeClass the type def for the classes a Node can be

const (
	NcTask    NodeClass = "task"
	NcMerge   NodeClass = "merge"
	NcTrigger NodeClass = "trigger"
)

NodeClass values

type NodeRef

type NodeRef struct {
	Class NodeClass
	ID    string
}

NodeRef uniquely identifies a Node across time (versions)

func (NodeRef) String

func (n NodeRef) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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