Documentation
¶
Overview ¶
Package vai provides a simple task runner.
Index ¶
- Constants
- Variables
- func ExecuteUses(ctx context.Context, store *uses.Store, u string, with With, prev string, ...) error
- func ParseOutput(r io.ReadSeeker) (map[string]string, error)
- func Run(ctx context.Context, store *uses.Store, wf Workflow, taskName string, ...) error
- func Validate(wf Workflow) error
- func WorkFlowSchema() *jsonschema.Schema
- type CommandOutputs
- type Step
- type Task
- type With
- type WithEntry
- type Workflow
Constants ¶
const CacheEnvVar = "VAI_CACHE"
CacheEnvVar is the environment variable for the cache directory.
const DefaultFileName = "vai.yaml"
DefaultFileName is the default file name
const DefaultTaskName = "default"
DefaultTaskName is the default task name
Variables ¶
var EnvVariablePattern = regexp.MustCompile("^[a-zA-Z_]+[a-zA-Z0-9_]*$")
EnvVariablePattern is a regular expression for valid environment variable names
var TaskNamePattern = regexp.MustCompile("^[_a-zA-Z][a-zA-Z0-9_-]*$")
TaskNamePattern is a regular expression for valid task names, it is also used for step IDs
Functions ¶
func ExecuteUses ¶ added in v0.1.6
func ExecuteUses(ctx context.Context, store *uses.Store, u string, with With, prev string, dry bool) error
ExecuteUses runs a task from a remote workflow source.
func ParseOutput ¶ added in v0.1.10
func ParseOutput(r io.ReadSeeker) (map[string]string, error)
ParseOutput parses the output file of a step
Matches behavior of GitHub Actions.
func Run ¶
func Run(ctx context.Context, store *uses.Store, wf Workflow, taskName string, outer With, origin string, dry bool) error
Run executes a task in a workflow with the given inputs.
For all `uses` steps, this function will be called recursively.
func WorkFlowSchema ¶
func WorkFlowSchema() *jsonschema.Schema
WorkFlowSchema returns a JSON schema for a vai workflow
Types ¶
type CommandOutputs ¶
CommandOutputs is a map of step IDs to their outputs.
type Step ¶
type Step struct {
// Run is the command/script to run
Run string `json:"run,omitempty"`
// Eval is an expression to evaluate with tengo
Eval string `json:"eval,omitempty"`
// Uses is a reference to another task
Uses string `json:"uses,omitempty"`
// With is a map of additional parameters for the step/task call
With `json:"with,omitempty"`
// ID is a unique identifier for the step
ID string `json:"id,omitempty"`
// Name is a human-readable name for the step
Name string `json:"name,omitempty"`
}
Step is a single step in a task
While a step can have any combination of `run`, `eval`, and `uses` fields, only one of them should be set at a time.
This is enforced by JSON schema validation.
func (Step) JSONSchemaExtend ¶
func (Step) JSONSchemaExtend(schema *jsonschema.Schema)
JSONSchemaExtend extends the JSON schema for a step
type With ¶
With is a map of string keys and WithEntry values used to pass parameters to called tasks and within steps
Each key will be mapped to an equivalent environment variable when the command is run. eg. `with: {foo: bar}` will be passed as `foo=bar` to the command.
func PerformLookups ¶
func PerformLookups(ctx context.Context, outer, local With, previousOutputs CommandOutputs) (With, error)
PerformLookups evaluates the expressions in the local With map
type Workflow ¶
Workflow is a map of tasks, where the key is the task name
This is the main structure that represents `vai.yaml` and other vai workflow files
func ReadAndValidate ¶
ReadAndValidate reads and validates a workflow
func (Workflow) OrderedTaskNames ¶ added in v0.1.8
OrderedTaskNames returns a list of task names in alphabetical order
The default task is always first
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmd provides the root command for the vai CLI.
|
Package cmd provides the root command for the vai CLI. |
|
vai
command
Package main is the entry point for the application
|
Package main is the entry point for the application |
|
Package main provides the entry point for the application.
|
Package main provides the entry point for the application. |
|
Package modv provides extra tengo modules for vai.
|
Package modv provides extra tengo modules for vai. |
|
Package uses provides a cache+clients for storing and retrieving remote workflows.
|
Package uses provides a cache+clients for storing and retrieving remote workflows. |