workflows

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	KeywordTrigger = "trigger"
)

Variables

View Source
var (
	InterpolationTokenRe = regexp.MustCompile(`^\$\((\S+)\)$`)
)

Functions

func DeepMap

func DeepMap(input any, transform func(el string) (any, error)) (any, error)

DeepMap recursively applies a transformation function over each string within:

  • a map[string]any
  • a []any
  • a string

func GenerateJSONSchema

func GenerateJSONSchema() ([]byte, error)

func WFYamlSpec

func WFYamlSpec(t *testing.T, name, owner string) string

WFYamlSpec generates a validate yaml spec for a workflow for the given name and owner

Types

type DependencyGraph

type DependencyGraph struct {
	ID string
	graph.Graph[string, *Vertex]

	Triggers []*StepDefinition

	Spec *WorkflowSpec
}

DependencyGraph is an intermediate representation of a workflow wherein all the graph vertices are represented and validated. It is a static representation of the workflow dependencies.

func ParseDependencyGraph added in v0.2.0

func ParseDependencyGraph(yamlWorkflow string) (*DependencyGraph, error)

type StepDefinition added in v0.2.0

type StepDefinition struct {
	ID     string
	Ref    string
	Inputs StepInputs
	Config map[string]any

	CapabilityType capabilities.CapabilityType
}

StepDefinition is the parsed representation of a step in a workflow.

Within the workflow spec, they are called "Capability Properties".

type StepInputs added in v0.2.0

type StepInputs struct {
	OutputRef string
	Mapping   map[string]any
}

type Vertex

type Vertex struct {
	StepDefinition
	Dependencies []string
}

func (*Vertex) VID

func (v *Vertex) VID() string

VID is an identifier for a Vertex that can be used to uniquely identify it in a graph. it represents the notion `hash` in the graph package AddVertex method. we refrain from naming it `hash` to avoid confusion with the hash function.

type WorkflowSpec added in v0.2.0

type WorkflowSpec struct {
	Name      string
	Owner     string
	Triggers  []StepDefinition
	Actions   []StepDefinition
	Consensus []StepDefinition
	Targets   []StepDefinition
	// contains filtered or unexported fields
}

WorkflowSpec is the parsed representation of a workflow. It is a derived representation of the yaml spec. Marshalling this struct is not guaranteed to produce the original yaml spec. Access the original yaml spec using the `String` method.

func ParseWorkflowSpecYaml

func ParseWorkflowSpecYaml(data string) (WorkflowSpec, error)

func (*WorkflowSpec) CID added in v0.2.0

func (w *WorkflowSpec) CID() string

CID returns the content hash of the original yaml spec of the workflow.

func (*WorkflowSpec) Steps added in v0.2.0

func (w *WorkflowSpec) Steps() []StepDefinition

func (*WorkflowSpec) String added in v0.2.0

func (w *WorkflowSpec) String() string

String returns the original yaml spec of the workflow.

Jump to

Keyboard shortcuts

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