rocket

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvTag is the root tag used in template data for environment variables
	// eg PATH is .Env.PATH.
	EnvTag = "Env"

	// ParentEnvTag is the root tag for environment variables when the task is not trusted.
	ParentEnvTag = "ParentEnv"

	// RuntimeTag is the remplate data key to the run time data.
	RuntimeTag = "Runtime"

	// BuildTag is the data template key for build information about the hosting application.
	BuildTag = "Build"

	// VariableTag is the top key for variables in the template data.
	VariableTag = "Var"

	// AdditionalMissionTag is the data template key to additional mission information.
	AdditionalMissionTag = "Additional"

	// MissionFileParamName is param name of the mission file.
	MissionFileParamName = "missionFile"

	// MissionBaseParamName is the base name of the mission file, without path or extensions.
	MissionBaseParamName = "missionBaseName"

	// MissionDirURLParamName is the full url to the directory containing the mission.
	MissionDirURLParamName = "missionDirURL"

	// MissionDirParamName is the file system path to the file.
	MissionDirParamName = "missionDir"

	// MissionDirAbsParamName is the file system absolute path to the file.
	MissionDirAbsParamName = "missionDirAbs"

	// MissionURLParamName is the full url to the mission file.
	MissionURLParamName = "missionURL"

	// WorkingDirectoryParamName is the name of the working dir.
	WorkingDirectoryParamName = "workingDir"
)
View Source
const (
	// InputIO is the input file key.
	InputIO = providers.ResourceID("input")
	// OutputIO is the output file key.
	OutputIO = providers.ResourceID("output")
	// ErrorIO is the error file key.
	ErrorIO = providers.ResourceID("error")

	// Stdin is the Std in resource.
	Stdin = providers.ResourceID("stdin")
	// Stdout is the Std out resource.
	Stdout = providers.ResourceID("stdout")
	// Stderr is the Std error resource.
	Stderr = providers.ResourceID("stderr")
)

Variables

This section is empty.

Functions

func NewContextWithCapComm

func NewContextWithCapComm(ctx context.Context, capComm *CapComm) context.Context

NewContextWithCapComm creates a new context with capComm attached.

Types

type Blueprint added in v0.2.1

type Blueprint struct {
	// Name of the blueprint.
	Name string `mapstructure:"name"`

	// Location is the location of the blueprint, set at read time
	Location string `mapstructure:"-"`

	// Description is a free text description of the blueprint
	Description string `mapstructure:"description"`

	// Location of runbook pro forma
	Runbook *Location `mapstructure:"runbook"`

	// Location of the mission
	Mission Location `mapstructure:"mission"`

	// Params is a list of parameters needed for the runbook.
	Params []Param `mapstructure:"params"`
}

Blueprint is a ready to assemble mission.

type BlueprintInfo added in v0.2.1

type BlueprintInfo struct {
	// Name of the blueprint.
	Name string `mapstructure:"name"`

	// Version of the blueprint
	Version string `json:"version,omitempty" yaml:"version,omitempty" mapstructure:"version"`

	// Location is the location of the blueprint
	Location string `mapstructure:"location"`

	// Description is a free text description of the blueprint
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description"`
}

BlueprintInfo contains information about a blueprint.

type CapComm

type CapComm struct {
	// contains filtered or unexported fields
}

CapComm handles all communication between mission control and the mission stages and tasks.

func GetCapCommContext

func GetCapCommContext(ctx context.Context) *CapComm

GetCapCommContext returns the capComm from the context.

func NewCapComm added in v0.1.2

func NewCapComm(missionLocation string, log loggee.Logger) *CapComm

NewCapComm returns a cap comm object that is suitable for using for testing.

func (*CapComm) AddAdditionalMissionData

func (capComm *CapComm) AddAdditionalMissionData(missionData TemplateData) *CapComm

AddAdditionalMissionData adds the additional mission data.

func (*CapComm) AddFileResource added in v0.1.0

func (capComm *CapComm) AddFileResource(ctx context.Context, name providers.ResourceID, filePath string, mode providers.IOMode) error

AddFileResource adds a key named file specificsation into the CapComm. The filePath follows standard template and environment variable expansion. The mode controls how the file will be used. Files can be added to sealed CapComm's.

func (*CapComm) AddResource added in v0.1.0

func (capComm *CapComm) AddResource(name providers.ResourceID, provider providers.ResourceProvider)

AddResource adds a resource to the capComm object.

func (*CapComm) AttachInputSpec added in v0.1.0

func (capComm *CapComm) AttachInputSpec(ctx context.Context, name providers.ResourceID, inputSpec InputSpec) error

AttachInputSpec adds a named input runbook to the capCom resources.

func (*CapComm) AttachOutputSpec added in v0.1.0

func (capComm *CapComm) AttachOutputSpec(ctx context.Context, name providers.ResourceID, outputSpec OutputSpec) error

AttachOutputSpec attaches an output runbook to the capComm.

func (*CapComm) AttachRedirect

func (capComm *CapComm) AttachRedirect(ctx context.Context, redirect Redirection) error

AttachRedirect attaches a redirection runbook to the capComm Redirection covers in, out and error streams.

func (*CapComm) Copy

func (capComm *CapComm) Copy(noTrust bool) *CapComm

Copy creates a new unsealed CapComm instance and deep copies the current CapComm's values into it.

func (*CapComm) ExpandBool added in v0.3.0

func (capComm *CapComm) ExpandBool(ctx context.Context, name, value string) (bool, error)

ExpandBool expands a template expression and converts the result to a bool value.

func (*CapComm) ExpandString

func (capComm *CapComm) ExpandString(ctx context.Context, name, value string) (string, error)

ExpandString expands a templated string using the capComm's template data.

func (*CapComm) ExportVariable added in v0.1.0

func (capComm *CapComm) ExportVariable(key, value string) *CapComm

ExportVariable exports the passed variable to all capComm's sharing the same parent as the receiver.

func (*CapComm) ExportVariables added in v0.3.0

func (capComm *CapComm) ExportVariables(exports Exports)

ExportVariables exports a list of variables if set in the capComm to aa parent. If the variable is not found the exported name will be checked against the params and exported.

func (*CapComm) FuncMap

func (capComm *CapComm) FuncMap() template.FuncMap

FuncMap returns the function mapping used by CapComm.

func (*CapComm) GetExecEnv

func (capComm *CapComm) GetExecEnv() []string

GetExecEnv converts the environment variables map into the string format needed for a exec Cmd.

func (*CapComm) GetResource added in v0.1.0

func (capComm *CapComm) GetResource(name providers.ResourceID) providers.ResourceProvider

GetResource a resource.

func (*CapComm) GetTemplateData

func (capComm *CapComm) GetTemplateData(ctx context.Context) TemplateData

GetTemplateData gts the data collection supplied to a template.

func (*CapComm) GetVariable added in v0.3.0

func (capComm *CapComm) GetVariable(key string) (string, bool)

GetVariable gets the value of a variable, first from local variables and then if not found from the exported parent variables.

func (*CapComm) InputSpecToResourceProvider added in v0.1.0

func (capComm *CapComm) InputSpecToResourceProvider(ctx context.Context, inputSpec InputSpec) (providers.ResourceProvider, error)

InputSpecToResourceProvider creates a resource provider from the supplied input runbook.

func (*CapComm) Log added in v0.1.0

func (capComm *CapComm) Log() loggee.Logger

Log returns the cap com logger.

func (*CapComm) MergeBasicEnvMap

func (capComm *CapComm) MergeBasicEnvMap(env VarMap) *CapComm

MergeBasicEnvMap adds environment variables into an unsealed CapComm.

func (*CapComm) MergeParams

func (capComm *CapComm) MergeParams(ctx context.Context, params []Param) error

MergeParams adds params into an unsealed CapComm instance.

func (*CapComm) MergeTemplateEnvs

func (capComm *CapComm) MergeTemplateEnvs(ctx context.Context, env VarMap) error

MergeTemplateEnvs adds params into an unsealed CapComm instance.

func (*CapComm) OutputSpecToResourceProvider added in v0.1.0

func (capComm *CapComm) OutputSpecToResourceProvider(ctx context.Context, outputSpec OutputSpec) (providers.ResourceProvider, error)

OutputSpecToResourceProvider creates a resource provider from a output specificsation.

func (*CapComm) Seal

func (capComm *CapComm) Seal() *CapComm

Seal prevents further editing of the capComm any attempt to edit will cause a panic (as this is a development bug).

func (*CapComm) SetLocalVariable added in v0.3.0

func (capComm *CapComm) SetLocalVariable(key, value string) *CapComm

SetLocalVariable sets a local capComm's variable.

func (*CapComm) WithMission

func (capComm *CapComm) WithMission(mission *Mission) *CapComm

WithMission attaches the mission to the CapComm.

type ExecuteFunc

type ExecuteFunc = loggee.ActivityFunc

ExecuteFunc is the function signature of an activity that can be executed.

type Exports added in v0.3.0

type Exports []string

Exports is a list of exported variables from on task context to another.

func (Exports) Copy added in v0.3.0

func (exports Exports) Copy() Exports

Copy copies the must have params.

type Filter

type Filter struct {
	// IncludeOS is a list of operating systems to include.
	IncludeOS []string `mapstructure:"includeOS"`

	// IncludeArch is a list of architectures to permit.
	IncludeArch []string `mapstructure:"includeArch"`

	// ExcludeOS restricts an operating system from running.
	ExcludeOS []string `mapstructure:"excludeOS"`

	// ExcludeArch restricts specific architectures from running.
	ExcludeArch []string `mapstructure:"excludeArch"`

	// Skip prevents theactivity from running if true.
	Skip bool `mapstructure:"skip"`
}

Filter restricts running an activity The filter applis to the OS and Architecture of the machine running rocket. This allows OS specific scripts to be used.

func (*Filter) IsFiltered added in v0.3.0

func (filter *Filter) IsFiltered() bool

IsFiltered returns true if the filter should be applied to exclude the item.

type Getter

type Getter interface {
	// Get a value
	Get(key string) string

	// All returns all the entries
	All() map[string]string
}

Getter returns a value for an input key, iif the key is not found an empty string is returned.

type Include

type Include struct {
	Path string `mapstructure:"path"`
	URL  string `mapstructure:"url"`
}

Include contains details of an include file within the config.

func (*Include) Validate added in v0.2.1

func (l *Include) Validate() error

Validate checks that include has one and only one resource identifier defined.

type InputSpec added in v0.1.0

type InputSpec struct {
	// Variable name to import from.
	Variable string `mapstructure:"variable"`

	Inline string `mapstructure:"inline"`

	// Path provides the path to the input file.
	Path string `mapstructure:"path"`

	// URl provides a url to th input data.
	URL string `mapstructure:"url"`

	// Optional is true if resource can be missing.
	Optional bool `mapstructure:"optional"`

	// URLTimeout request timeout, default is 30 seconds.
	URLTimeout uint `mapstructure:"timeout"`

	// SkipExpand when true skips template expansion of the runbook.
	SkipExpand bool `mapstructure:"skipExpand"`
}

InputSpec is a resource input specificsation. Input data can be provided from inline valuses, exported stage variables, local files or a web url.

type Inventory added in v0.2.1

type Inventory struct {
	Items []string `mapstructure:"items"`
}

Inventory is a list of blueprints.

type KeyValueGetter

type KeyValueGetter struct {
	// contains filtered or unexported fields
}

KeyValueGetter is a value map with fallback to a parent Getter.

func NewKeyValueGetter

func NewKeyValueGetter(parent Getter) *KeyValueGetter

NewKeyValueGetter creates a new KeyValueGetter.

func (*KeyValueGetter) All

func (kvg *KeyValueGetter) All() map[string]string

All returns the values tp down, where child values override parent key values.

func (*KeyValueGetter) Get

func (kvg *KeyValueGetter) Get(key string) string

Get returns the value for a key.

type Location added in v0.2.1

type Location struct {
	// Inline detail
	Inline string `mapstructure:"inline"`

	// Path provides the path to the item, relative to the blueprints location
	Path string `mapstructure:"path"`
}

Location is a location of input data.

func (*Location) Validate added in v0.2.1

func (l *Location) Validate() error

Validate checks the object meets the validation requirements to have one and only one of the source properties defined.

type Mission

type Mission struct {
	// Mission name, defaults to the config file name
	Name string `mapstructure:"name"`

	// Description is a free text description of the mission.
	Description string `mapstructure:"description"`

	// Additional contains any additional parameters specified in the
	// configuration.  They are included in the template data set
	// but will be overridden by any other duplicate keys
	Additional map[string]interface{} `mapstructure:",remain"`

	// BasicEnv is a map of additional environment variables
	// They are not template expanded
	BasicEnv VarMap `mapstructure:"basicEnv"`

	// Env is a map of additional environment variables
	// These are subject to template expansion after the params have been expanded
	Env VarMap `mapstructure:"env"`

	// Must is a slice of params that must be defined prior to the mission starting
	// Iif any are missing the mission will fail.
	Must MustHaveParams `mapstructure:"must"`

	// Params is a collection of parameters that can be used within
	// the child stages.  Parameters are template expanded and can use
	// Environment variables defined in Env
	Params Params `mapstructure:"params"`

	// Sequences specify a list of stages to run.
	// If no sequences are provides all stages are run in the order they are defined.
	// If sequences are included in the mission one must be specified or the mission will fail
	Sequences map[string][]string `mapstructure:"sequences"`

	// Stages represents the stages of the mission
	// If no sequences are included in the file all stages are executed in ordinal order.
	// If a sequence is included in the mission file the launch mission call must specify the sequence to use.
	Stages Stages `mapstructure:"stages"`

	// OnFail is a stage that is executed if the mission fails.
	OnFail *Stage `mapstructure:"onfail"`

	// Version of the mission definition
	Version string `mapstructure:"version"`
}

Mission is activity to complete.

type MissionController added in v0.2.1

type MissionController interface {
	// Set option sets options on the mission controller
	SetOptions(options ...Option) error

	// RegisterTaskTypes we only want the best.
	RegisterTaskTypes(types ...TaskType)

	// LaunchMission loads and executes the mission
	// flightSequences may be specified, each sequence is run in the order specified.
	// Location is used to indicate where the config was read from, if blank the current working directory is assumed.
	LaunchMission(ctx context.Context, location string, spaceDust map[string]interface{}, flightSequences ...string) error

	LaunchMissionWithParams(ctx context.Context, location string,
		spaceDust map[string]interface{},
		params Params,
		flightSequences ...string) error

	// Assemble locates a blueprint from the assembly sources, loads the runbook and builds the assembly following the runbook.
	Assemble(ctx context.Context, blueprint string, sources []string, runbook string, params Params) error

	// GetRunbook gets the runbook for a blueprint
	GetRunbook(ctx context.Context, blueprintName string, sources []string) (string, error)

	// ListBlueprints builds a list of all blueprints found in the passed sources
	ListBlueprints(ctx context.Context, sources []string) ([]BlueprintInfo, error)

	ListTaskTypes(ctx context.Context) (TaskTypeInfoList, error)
}

MissionController seeks out new civilizations in te CI space.

func Default

func Default() MissionController

Default returns the default shared mission control.

func NewMissionControl

func NewMissionControl() MissionController

NewMissionControl create a new mission control.

type MustHaveParams added in v0.2.1

type MustHaveParams []string

MustHaveParams is a slice of param names that must be definedbefore a mission, stage or activity starts. The list is checked prior too processing the activities own set of param definitions.

func (MustHaveParams) Copy added in v0.3.0

func (params MustHaveParams) Copy() MustHaveParams

Copy copies the must have params.

type OperationHandler added in v0.3.0

type OperationHandler func(next ExecuteFunc) ExecuteFunc

OperationHandler is a handler function that given a operations next function returns the function replacing it.

type Option added in v0.2.1

type Option interface {
	Name() string
}

Option is the interface supported by all mission options.

func LoggerOption added in v0.2.1

func LoggerOption(log loggee.Logger) Option

LoggerOption sets specifies the logger to use with the mission control.

type OutputSpec

type OutputSpec struct {
	// Variable is an exported variable available to later tasks in the same stage.
	Variable string `mapstructure:"variable"`

	// Output is a path to a file replacing STDOUT.
	Path string `mapstructure:"path"`

	// AppendOutput specifies if output should append.
	Append bool `mapstructure:"append"`

	// SkipExpand when true skips template expansion of the runbook.
	SkipExpand bool `mapstructure:"skipExpand"`

	// OS File permissions
	FileMode uint `mapstructure:"fileMode"`
}

OutputSpec defines the method of outputtting for a given resource. The choice is either variables or files.

type Param

type Param struct {
	// Name is the name of the parameter.
	// Name is mandatory.
	Name string `mapstructure:"name"`

	// Description is a free text description of the parameter.
	Description string `mapstructure:"description"`

	// Filter is an optional filter on the param.
	// If the param criteria are not met the param value will not be set.
	Filter *Filter `mapstructure:"filter"`

	// Optional if true allows the file not to exist.
	Optional bool `mapstructure:"optional"`

	// Path is the location of a resource that can provide the parameter's value.
	// Paths may be either a local file system path or a url to file or http(s) resource.
	// If both Path and Value are supplied the resource value will be appended to the Value.
	// Template expressions can be used in the path.  The template is expanded to get the
	// location of the resource.
	//
	// If the resource is successfully located it is appended to the Value property.
	// If SkipExpand is false the combined value will be processed as a template to
	// obtain the final value.   If SkipExpand is true the combined value will be used without
	// any additional expansion.
	Path string `mapstructure:"path"`

	// Print if true will display the value of the parameter once expanded to the log.
	Print bool `mapstructure:"print"`

	// SkipExpand skip templating the param.
	SkipExpand bool `mapstructure:"skipExpand"`

	// Value is the value of the parameter.  If SkipExpand is false the value will
	// be transformed using template expansion.
	Value string `mapstructure:"value"`
}

Param is an expandible parameter.

type Params added in v0.3.0

type Params []Param

Params is a slice of params.

func (Params) Copy added in v0.3.0

func (params Params) Copy() Params

Copy the params.

type PreMission

type PreMission struct {
	Mission  map[string]interface{} `mapstructure:",remain"`
	Includes []Include              `mapstructure:"includes"`
}

PreMission preprocesses missions before loading them.

type Redirection

type Redirection struct {
	// Input runbook
	Input *InputSpec `mapstructure:"input"`

	// Output runbook
	Output *OutputSpec `mapstructure:"output"`

	// Error runbook
	Error *OutputSpec `mapstructure:"error"`

	// MergeErrorWithOutput specifies if error output should go to outputt
	// if specified Error and AppendError are ignored
	MergeErrorWithOutput bool `mapstructure:"merge"`

	// LogOutput if true will cause output to be logged rather than going to go to std output.
	// If an output file is specified it will be used instead.
	LogOutput bool `mapstructure:"logStdOut"`

	// DirectError when true causes the commands std error output to go direct to running processes std error
	// When DirectError is false std error output is logged.
	DirectError bool `mapstructure:"directStdErr"`
}

Redirection is provided to a task to interpret Redirection strings need to be expanded by the task.

type Runbook added in v0.2.1

type Runbook struct {
	// Name of the runbook.
	Name string `mapstructure:"name"`

	// Blueprint is the name of the blue print
	Blueprint string `mapstructure:"blueprint"`

	// Params is a list of parameters needed for the runbook.
	Params []Param `mapstructure:"params"`

	FlightSequence []string `mapstructure:"sequence"`
}

Runbook is a list of parameters required to complete a blueprint assembly.

type Runtime

type Runtime struct {
	// GOOS is the operating system the host application is running against
	GOOS string
	// GOARCH is the architecture the host application is running against
	GOARCH string

	// UserName runtime username
	UserName string
}

Runtime holds runtime data accessible to templates.

type Stage

type Stage struct {
	// Name of the stage.
	// If it is not provided it default to the ordinal ID of the stage within the mission
	Name string `mapstructure:"name"`

	// Stage is impmented by another named stage.
	Ref string `mapstructure:"ref"`

	// Description is a free text description of the stage.
	Description string `mapstructure:"description"`

	// BasicEnv is a map of additional environment variables
	// They are not template expanded
	BasicEnv VarMap `mapstructure:"basicEnv"`

	// If is evaluated prior to running a stage.  If the condition template expression evaluates to true/yes/1 the
	// stage will be run.  If the template is blank or non true value the stage will not be run and the step will be skipped.
	If string `mapstructure:"if"`

	// Dir is the directory to execute the stage in.
	Dir string `mapstructure:"dir"`

	// Env is a map of additional environment variables
	// These are subject to template expansion after the params have been expanded.
	Env VarMap `mapstructure:"env"`

	// Filter is an optional filter on the stage.
	// If the filter criteria are not met the stage will not be executed.
	Filter *Filter `mapstructure:"filter"`

	// Must is a slice of params that must be defined prior to the stage starting
	// Iif any are missing the mission will fail.
	Must MustHaveParams `mapstructure:"must"`

	// NoTrust indicates the stage should not inherit environment
	// variables or parameters from its parent.  This can be used with a run stage
	// where you do not want the process to receive API tokens etc.
	NoTrust bool `mapstructure:"noTrust"`

	// OnFail is a task that is executed if the stage fails.
	OnFail *Task `mapstructure:"onfail"`

	// Params is a collection of parameters that can be used within
	// the child stages.  Parameters are template expanded and can use
	// Environment variables defined in Env
	Params Params `mapstructure:"params"`

	// Tasks is a collection of one or more tasks to execute
	// Tasks are executed sequentially
	Tasks Tasks `mapstructure:"tasks"`
}

Stage is a collection of tasks that can share a common set of parameters. All tasks within a stage are executed sequently.

type StageMap added in v0.3.0

type StageMap map[string]Stage

StageMap is a map of stage names to stages.

type Stages added in v0.3.0

type Stages []Stage

Stages is a slice of stages.

type Task

type Task struct {
	// Name of the task.
	// If it is not provided it default to the ordinal ID of the task within the stage
	Name string `mapstructure:"name"`

	// Task is impmented by another named task in the same stage.
	Ref string `mapstructure:"ref"`

	// BasicEnv is a map of additional environment variables.
	// They are not template expanded.
	BasicEnv VarMap `mapstructure:"basicEnv"`

	// Concurrent is a list of tasks to execute concurrently.
	Concurrent Tasks `mapstructure:"concurrent"`

	// If is evaluated prior to running a task.  If the condition template expression evaluates to true/yes/1 the
	// task will be run.  If the template is blank or non true value the task will not be run and the step will be skipped.
	If string `mapstructure:"if"`

	// Description is a free text description of the task.
	Description string `mapstructure:"description"`

	// Definition contains the additional data required to process the task type
	Definition map[string]interface{} `mapstructure:",remain"`

	// Env is a map of additional environment variables.
	// These are subject to template expansion after the params have been expanded.
	Env VarMap `mapstructure:"env"`

	// Export is a list of variables to export. This list can be used by try and group task types
	// to export their variables (output from sub tasks) to their parent stage or task.
	Export Exports `mapstructure:"export"`

	// Filter is an optional filter on the task.
	// If the filter criteria are not met the task will not be executed.
	Filter *Filter `mapstructure:"filter"`

	// Try is a list of tasks to try.
	Group Tasks `mapstructure:"group"`

	// Must is a slice of params that must be defined prior to the task starting
	// Iif any are missing the mission will fail.
	Must MustHaveParams `mapstructure:"must"`

	// NoTrust indicates the task should not inherit environment
	// variables or parameters from the parent.  This can be used with a run task
	// where you do not want the process to receive API tokens etc.
	NoTrust bool `mapstructure:"noTrust"`

	// OnFail is a task that is executed if the stage fails.
	OnFail *Task `mapstructure:"onfail"`

	// Params is a collection of parameters that can be used within
	// the child stages.  Parameters are template expanded and can use
	// Environment variables defined in Env.
	// Params and Env variables are template expanded during the preparation phase of a mission.  That means their
	// values are calculated prior to any task running in any stage.
	// If values need to be calculated before or after a run use pre or post variaBLES
	Params Params `mapstructure:"params"`

	// PostVars are variable evaluated after a task has run
	// Post variable are automatically exported to the parent task/stage.
	PostVars VarMap `mapstructure:"postvars"`

	// PreVars are variables calculated immediately prior to a run.  They are are not exported to the parent context.
	// If the variable needs to be used by other tasks it should be explicitly exported (See Export above).
	PreVars VarMap `mapstructure:"prevars"`

	// Try is a list of tasks to try.
	Try Tasks `mapstructure:"try"`

	// Type is the type of the task.  The task type must have been registered
	// with the mission control.  Tasks not registered will fail the mission.
	Type string `mapstructure:"type"`
}

Task is an activity that is executed.

type TaskMap added in v0.3.0

type TaskMap map[string]Task

TaskMap maps the task name to the task.

type TaskType

type TaskType interface {

	// Type of the task.
	Type() string

	// Description is a free text description of the type
	Description() string

	// Prepare the task from the input details.
	Prepare(ctx context.Context, capComm *CapComm, task Task) (ExecuteFunc, error)
}

TaskType represents a specific task type.

type TaskTypeInfo added in v0.3.0

type TaskTypeInfo struct {
	// Type of task.
	Type string `mapstructure:"name"`

	// Description is a free text description of the task
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description"`
}

TaskTypeInfo describes a task type.

type TaskTypeInfoList added in v0.3.0

type TaskTypeInfoList []TaskTypeInfo

TaskTypeInfoList is a list of task type info.

func (TaskTypeInfoList) Len added in v0.3.0

func (list TaskTypeInfoList) Len() int

Len is the number of elements in the collection.

func (TaskTypeInfoList) Less added in v0.3.0

func (list TaskTypeInfoList) Less(i, j int) bool

Less reports whether the element with index i must sort before the element with index j.

func (TaskTypeInfoList) Swap added in v0.3.0

func (list TaskTypeInfoList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Tasks added in v0.3.0

type Tasks []Task

Tasks is a slice of tasks.

func (Tasks) Copy added in v0.3.0

func (tasks Tasks) Copy() Tasks

Copy the tasks.

func (Tasks) ToMap added in v0.3.0

func (tasks Tasks) ToMap() TaskMap

ToMap converts the task slice to a map using the task name as the key.

type TemplateData

type TemplateData map[string]interface{}

TemplateData represents the data passed t a template.

type VarMap added in v0.3.0

type VarMap map[string]string

VarMap is a map of variables to their values.

func (VarMap) Copy added in v0.3.0

func (em VarMap) Copy() VarMap

Copy copies an environment map.

Jump to

Keyboard shortcuts

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