Documentation ¶
Index ¶
- Variables
- func Always(ctx Context) (bool, error)
- func GetAnyInput(ctx Context, name string, required bool) (any, error)
- func GetAnyValue(ctx Context, name string) (any, bool)
- func GetInput[T any](ctx Context, name string, required bool) (T, error)
- func GetValue[T any](ctx Context, name string) (T, error)
- type Command
- type Condition
- type ConditionFunc
- type Context
- type Input
- type Job
- type Ref
- type Step
- type StepFunc
- type Workflow
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidType = errors.New("invalid type")
)
Functions ¶
func GetAnyInput ¶
GetAnyInput returns a value or output in the ctx. If a value does not exist, nil is returned, with a nil error unless required is true.
func GetAnyValue ¶
GetAnyValue returns a value or output in the ctx.
Types ¶
type Command ¶
type Command func(ctx Context)
Command represents a side effect of a step. A step can return a command, which will then be executed after the stes completes. This enables a step to define outputs, values and more.
func SetOutput ¶
SetOutput returns a Command that will store an output. Setting an output from a step without an ID is a no-op. Outputs are named depending on their scope. Within the same job, a step will be named like so:
"step.<stepId>.<key>"
From another job, the output can be referenced like so:
"job.<jobId>.step.<stepId>.<key>"
type Condition ¶
type Condition = any
Condition controls whether or not a job or step (or post step) should run. A condition can be either a ConditionFunc, or a string which references a value retrievable using GetValue.
func ValueExists ¶ added in v0.13.0
ValueExists will evaluate to true if the given key has a value.
type ConditionFunc ¶
ConditionFunc is an adapter to allow the use of ordinary functions as Conditions.
type Context ¶
type Context struct { context.Context // Workflow is the current workflow. Workflow Workflow // Job is the current job. Job Job // Step is the current step. Step Step // Outputs holds the outputs of steps and jobs, mapped by their path. // Outputs should not be written directly, as they are managed by the workflow // runtime. // Example: // ctx.Outputs["step.getManifests.manifests"] // ctx.Outputs["jobs.oci.step.getManifests.manifests"] Outputs map[string]any // Values holds values (variables) stored by calling Store on a step to store // a named output. Values can later be used as inputs. // Values should not be written directly, as they are managed by the workflow // runtime. // Example: // FetchTitlesFromIMDB().Store("titles", "movieTitles") // CreateReportFromTitles("movieTitles") Values map[string]any // Error holds any current error of the context. Error error }
type Input ¶
type Input = any
Input is an input value to a step. A value can be either a Ref, or any verbatim value.
type Ref ¶
type Ref struct {
Key string
}
Ref is an Input that refers to a value retrievable by GetValue.