variant

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(stepLoader StepLoader)

Types

type AnyMap

type AnyMap map[string]interface{}

type Application

type Application struct {
	Name                string
	CommandRelativePath string
	CachedTaskOutputs   map[string]interface{}
	ConfigFile          string
	Verbose             bool
	Output              string
	Colorize            bool
	Env                 string
	TaskRegistry        *TaskRegistry
	InputResolver       InputResolver
	TaskNamer           *TaskNamer
	LogToStderr         bool
}

func (Application) DirectInputValuesForTaskKey

func (p Application) DirectInputValuesForTaskKey(taskName TaskName, args []string, arguments task.Arguments, scope map[string]interface{}, caller ...*Task) (map[string]interface{}, error)

func (Application) GetTmplOrTypedValueForConfigKey

func (p Application) GetTmplOrTypedValueForConfigKey(k string, tpe string) interface{}

func (Application) InheritedInputValuesForTaskKey

func (p Application) InheritedInputValuesForTaskKey(taskName TaskName, args []string, arguments task.Arguments, scope map[string]interface{}, caller ...*Task) (map[string]interface{}, error)

func (Application) RunTask

func (p Application) RunTask(taskName TaskName, args []string, arguments task.Arguments, scope map[string]interface{}, asInput bool, caller ...*Task) (string, error)

func (Application) RunTaskForKeyString

func (p Application) RunTaskForKeyString(keyStr string, args []string, arguments task.Arguments, scope map[string]interface{}, asInput bool, caller ...*Task) (string, error)

func (*Application) Tasks

func (p *Application) Tasks() map[string]*Task

func (Application) UpdateLoggingConfiguration

func (p Application) UpdateLoggingConfiguration()

type Artifact

type Artifact struct {
	Name string
	Path string
	Via  string
}

type Caller

type Caller interface {
	GetKey() Key
}

type CobraAdapter

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

func NewCobraAdapter

func NewCobraAdapter(app *Application) *CobraAdapter

func (*CobraAdapter) GenerateAllFlags

func (p *CobraAdapter) GenerateAllFlags()

func (*CobraAdapter) GenerateCommand

func (p *CobraAdapter) GenerateCommand(task *Task, rootCommand *cobra.Command) (*cobra.Command, error)

func (*CobraAdapter) Tasks

func (p *CobraAdapter) Tasks() map[string]*Task

type ExecutionContext

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

func NewStepExecutionContext

func NewStepExecutionContext(app Application, taskRunner TaskRunner, taskTemplate *TaskTemplate, asInput bool, trace []*Task) ExecutionContext

func (ExecutionContext) Autodir

func (c ExecutionContext) Autodir() bool

func (ExecutionContext) Autoenv

func (c ExecutionContext) Autoenv() bool

func (ExecutionContext) Caller

func (c ExecutionContext) Caller() []Caller

func (ExecutionContext) GenerateAutoenv

func (c ExecutionContext) GenerateAutoenv() (map[string]string, error)

func (ExecutionContext) Interactive

func (c ExecutionContext) Interactive() bool

func (ExecutionContext) Key

func (c ExecutionContext) Key() Key

func (ExecutionContext) Render

func (c ExecutionContext) Render(expr string, name string) (string, error)

func (ExecutionContext) RunAnotherTask

func (c ExecutionContext) RunAnotherTask(key string, arguments task.Arguments, scope map[string]interface{}) (string, error)

func (ExecutionContext) Vars

func (c ExecutionContext) Vars() map[string]interface{}

type IfStep

type IfStep struct {
	Name string
	If   []Step
	Then []Step
	// contains filtered or unexported fields
}

func (IfStep) GetName

func (s IfStep) GetName() string

func (IfStep) Run

func (s IfStep) Run(context ExecutionContext) (StepStringOutput, error)

func (IfStep) Silent

func (s IfStep) Silent() bool

type IfStepLoader

type IfStepLoader struct{}

func NewIfStepLoader

func NewIfStepLoader() IfStepLoader

func (IfStepLoader) LoadStep

func (l IfStepLoader) LoadStep(config StepDef, context LoadingContext) (Step, error)

type Input

type Input struct {
	InputConfig
	TaskKey  TaskName
	FullName string
}

func (*Input) ShortName

func (v *Input) ShortName() string

type InputConfig

type InputConfig struct {
	Name          string                            `yaml:"name,omitempty"`
	Description   string                            `yaml:"description,omitempty"`
	ArgumentIndex *int                              `yaml:"argument-index,omitempty"`
	Type          string                            `yaml:"type,omitempty"`
	Default       interface{}                       `yaml:"default,omitempty"`
	Properties    map[string]map[string]interface{} `yaml:"properties,omitempty"`
	Remainings    map[string]interface{}            `yaml:",inline"`
}

func (*InputConfig) DefaultAsArray

func (c *InputConfig) DefaultAsArray() ([]interface{}, error)

func (*InputConfig) DefaultAsBool

func (c *InputConfig) DefaultAsBool() bool

func (*InputConfig) DefaultAsInt

func (c *InputConfig) DefaultAsInt() int

func (*InputConfig) DefaultAsObject

func (c *InputConfig) DefaultAsObject() (map[string]interface{}, error)

func (*InputConfig) DefaultAsString

func (c *InputConfig) DefaultAsString() string

func (*InputConfig) JSONSchema

func (c *InputConfig) JSONSchema() map[string]interface{}

func (*InputConfig) Required

func (c *InputConfig) Required() bool

func (*InputConfig) TypeName

func (c *InputConfig) TypeName() string

type InputResolver

type InputResolver interface {
	ResolveInputs()
	ResolveInputsForTask(flowDef *Task) []*Input
	ResolveInputsForTaskKey(currentTaskKey TaskName, path string) []*Input
}

func NewRegistryBasedInputResolver

func NewRegistryBasedInputResolver(registry *TaskRegistry, flowKeyCreator *TaskNamer) InputResolver

type Key

type Key interface {
	ShortString() string
	Parent() (Key, error)
}

type LoadingContext

type LoadingContext interface {
	LoadStep(config StepDef) (Step, error)
}

type MessageOnlyFormatter

type MessageOnlyFormatter struct {
}

func (*MessageOnlyFormatter) Format

func (f *MessageOnlyFormatter) Format(entry *log.Entry) ([]byte, error)

type OptionConfig

type OptionConfig struct {
	Name        string                            `yaml:"name,omitempty"`
	Description string                            `yaml:"description,omitempty"`
	Type        string                            `yaml:"type,omitempty"`
	Default     interface{}                       `yaml:"default,omitempty"`
	Required    bool                              `yaml:"required,omitempty"`
	Properties  map[string]map[string]interface{} `yaml:"properties,omitempty"`
	Remainings  map[string]interface{}            `yaml:",inline"`
}

type OrStep

type OrStep struct {
	Name  string
	Steps []Step
	// contains filtered or unexported fields
}

func (OrStep) GetName

func (s OrStep) GetName() string

func (OrStep) Run

func (s OrStep) Run(context ExecutionContext) (StepStringOutput, error)

func (OrStep) Silent

func (s OrStep) Silent() bool

type OrStepLoader

type OrStepLoader struct{}

func NewOrStepLoader

func NewOrStepLoader() OrStepLoader

func (OrStepLoader) LoadStep

func (l OrStepLoader) LoadStep(config StepDef, context LoadingContext) (Step, error)

type ParameterConfig

type ParameterConfig struct {
	Name        string                            `yaml:"name,omitempty"`
	Description string                            `yaml:"description,omitempty"`
	Type        string                            `yaml:"type,omitempty"`
	Default     interface{}                       `yaml:"default,omitempty"`
	Required    bool                              `yaml:"required,omitempty"`
	Properties  map[string]map[string]interface{} `yaml:"properties,omitempty"`
	Remainings  map[string]interface{}            `yaml:",inline"`
}

type RegistryBasedInputResolver

type RegistryBasedInputResolver struct {
	InputResolver
	// contains filtered or unexported fields
}

func (*RegistryBasedInputResolver) ResolveInputs

func (r *RegistryBasedInputResolver) ResolveInputs()

func (*RegistryBasedInputResolver) ResolveInputsForTask

func (r *RegistryBasedInputResolver) ResolveInputsForTask(flowDef *Task) []*Input

func (*RegistryBasedInputResolver) ResolveInputsForTaskKey

func (r *RegistryBasedInputResolver) ResolveInputsForTaskKey(currentTaskKey TaskName, path string) []*Input

type ScriptStep

type ScriptStep struct {
	Name string
	Code string
	// contains filtered or unexported fields
}

func (ScriptStep) GetName

func (s ScriptStep) GetName() string

func (ScriptStep) Run

func (ScriptStep) Silent

func (s ScriptStep) Silent() bool

type ScriptStepLoader

type ScriptStepLoader struct{}

func NewScriptStepLoader

func NewScriptStepLoader() ScriptStepLoader

func (ScriptStepLoader) LoadStep

func (l ScriptStepLoader) LoadStep(def StepDef, context LoadingContext) (Step, error)

type Step

type Step interface {
	GetName() string
	Run(context ExecutionContext) (StepStringOutput, error)
	Silent() bool
}

func LoadStep

func LoadStep(config StepDef) (Step, error)

type StepDef

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

func NewStepDef

func NewStepDef(raw map[string]interface{}) StepDef

func (StepDef) Get

func (c StepDef) Get(key string) interface{}

func (StepDef) GetName

func (c StepDef) GetName() string

func (StepDef) GetStringMapOrEmpty

func (c StepDef) GetStringMapOrEmpty(key string) map[string]interface{}

func (StepDef) Raw

func (c StepDef) Raw() map[string]interface{}

func (StepDef) Script

func (c StepDef) Script() (string, bool)

func (StepDef) Silent

func (c StepDef) Silent() bool

type StepLoader

type StepLoader interface {
	LoadStep(config StepDef, context LoadingContext) (Step, error)
}

type StepStringOutput

type StepStringOutput struct {
	String string
}

type Task

type Task struct {
	TaskDef
	Name           TaskName
	ProjectName    string
	ResolvedInputs []*Input
	Tasks          []*Task
	Command        *cobra.Command
}

func (Task) GetKey

func (f Task) GetKey() TaskName

type TaskCreator

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

func NewTaskCreator

func NewTaskCreator(c *TaskNamer) *TaskCreator

func (*TaskCreator) Create

func (g *TaskCreator) Create(taskDef *TaskDef, parentTaskNameComponents []string, appName string) (*Task, error)

type TaskDef

type TaskDef struct {
	Name        string         `yaml:"name,omitempty"`
	Description string         `yaml:"description,omitempty"`
	Inputs      []*InputConfig `yaml:"inputs,omitempty"`
	TaskDefs    []*TaskDef     `yaml:"tasks,omitempty"`
	Script      string         `yaml:"script,omitempty"`
	Steps       []Step         `yaml:"steps,omitempty"`
	Autoenv     bool           `yaml:"autoenv,omitempty"`
	Autodir     bool           `yaml:"autodir,omitempty"`
	Interactive bool           `yaml:"interactive,omitempty"`
	Private     bool           `yaml:"private,omitempty"`
}

func NewDefaultTaskConfig

func NewDefaultTaskConfig() *TaskDef

func ReadTaskConfigFromBytes

func ReadTaskConfigFromBytes(data []byte) (*TaskDef, error)

func ReadTaskConfigFromFile

func ReadTaskConfigFromFile(path string) (*TaskDef, error)

func ReadTaskConfigFromString

func ReadTaskConfigFromString(data string) (*TaskDef, error)

func TransformV2FlowConfigMapToArray

func TransformV2FlowConfigMapToArray(v2 map[string]*TaskDef) []*TaskDef

func (*TaskDef) CopyTo

func (t *TaskDef) CopyTo(other *TaskDef)

func (*TaskDef) UnmarshalYAML

func (t *TaskDef) UnmarshalYAML(unmarshal func(interface{}) error) error

type TaskDefV1

type TaskDefV1 struct {
	Name        string                        `yaml:"name,omitempty"`
	Description string                        `yaml:"description,omitempty"`
	Inputs      []*InputConfig                `yaml:"inputs,omitempty"`
	Parameters  []*ParameterConfig            `yaml:"parameters,omitempty"`
	Options     []*OptionConfig               `yaml:"options,omitempty"`
	TaskDefs    []*TaskDef                    `yaml:"tasks,omitempty"`
	Runner      map[string]interface{}        `yaml:"runner,omitempty"`
	Script      string                        `yaml:"script,omitempty"`
	StepDefs    []map[interface{}]interface{} `yaml:"steps,omitempty"`
	Autoenv     bool                          `yaml:"autoenv,omitempty"`
	Autodir     bool                          `yaml:"autodir,omitempty"`
	Interactive bool                          `yaml:"interactive,omitempty"`
	Private     bool                          `yaml:"private,omitempty"`
}

type TaskDefV2

type TaskDefV2 struct {
	Description string                        `yaml:"description,omitempty"`
	Inputs      []*InputConfig                `yaml:"inputs,omitempty"`
	Parameters  []*ParameterConfig            `yaml:"parameters,omitempty"`
	Options     []*OptionConfig               `yaml:"options,omitempty"`
	Import      string                        `yaml:"import,omitempty"`
	TaskDefs    map[string]*TaskDef           `yaml:"tasks,omitempty"`
	Runner      map[string]interface{}        `yaml:"runner,omitempty"`
	Script      interface{}                   `yaml:"script,omitempty"`
	StepDefs    []map[interface{}]interface{} `yaml:"steps,omitempty"`
	Autoenv     bool                          `yaml:"autoenv,omitempty"`
	Autodir     bool                          `yaml:"autodir,omitempty"`
	Interactive bool                          `yaml:"interactive,omitempty"`
	Private     bool                          `yaml:"private,omitempty"`
}

type TaskName

type TaskName struct {
	Components []string
}

func (TaskName) AsStepKey

func (t TaskName) AsStepKey() Key

func (TaskName) Parent

func (t TaskName) Parent() (TaskName, error)

func (TaskName) ShortString

func (t TaskName) ShortString() string

func (TaskName) Simple

func (t TaskName) Simple() string

func (TaskName) String

func (t TaskName) String() string

type TaskNamer

type TaskNamer struct {
	AppName string
}

func NewTaskNamer

func NewTaskNamer(appName string) *TaskNamer

func (TaskNamer) FromInput

func (p TaskNamer) FromInput(input *InputConfig) TaskName

func (TaskNamer) FromInputName

func (p TaskNamer) FromInputName(inputName string) TaskName

func (TaskNamer) FromResolvedInput

func (p TaskNamer) FromResolvedInput(variable *Input) TaskName

func (TaskNamer) FromString

func (p TaskNamer) FromString(flowKeyStr string) TaskName

type TaskRegistry

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

func NewTaskRegistry

func NewTaskRegistry() *TaskRegistry

func (*TaskRegistry) AllTaskKeys

func (p *TaskRegistry) AllTaskKeys() []string

func (*TaskRegistry) FindTask

func (p *TaskRegistry) FindTask(name TaskName) *Task

func (*TaskRegistry) RegisterTasks

func (p *TaskRegistry) RegisterTasks(task *Task)

func (*TaskRegistry) Tasks

func (p *TaskRegistry) Tasks() map[string]*Task

type TaskRunner

type TaskRunner struct {
	*Task
	Values   map[string]interface{}
	Template *TaskTemplate
}

func NewTaskRunner

func NewTaskRunner(taskDef *Task, taskTemplate *TaskTemplate, vars map[string]interface{}) (TaskRunner, error)

func (TaskRunner) AsStepCaller

func (t TaskRunner) AsStepCaller() Caller

func (TaskRunner) GenerateAutoenv

func (t TaskRunner) GenerateAutoenv() (map[string]string, error)

func (TaskRunner) GenerateAutoenvRecursively

func (t TaskRunner) GenerateAutoenvRecursively(path string, env map[string]interface{}, toEnvName func(string) string) (map[string]string, error)

func (TaskRunner) GetKey

func (t TaskRunner) GetKey() Key

func (*TaskRunner) Run

func (t *TaskRunner) Run(project *Application, asInput bool, caller ...*Task) (string, error)

type TaskStep

type TaskStep struct {
	Name          string
	TaskKeyString string
	Arguments     task.Arguments
	// contains filtered or unexported fields
}

func (TaskStep) GetName

func (s TaskStep) GetName() string

func (TaskStep) Run

func (s TaskStep) Run(context ExecutionContext) (StepStringOutput, error)

func (TaskStep) Silent

func (s TaskStep) Silent() bool

type TaskStepLoader

type TaskStepLoader struct{}

func NewTaskStepLoader

func NewTaskStepLoader() TaskStepLoader

func (TaskStepLoader) LoadStep

func (l TaskStepLoader) LoadStep(stepConfig StepDef, context LoadingContext) (Step, error)

type TaskTemplate

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

func NewTaskTemplate

func NewTaskTemplate(task *Task, values map[string]interface{}) *TaskTemplate

func (*TaskTemplate) Render

func (t *TaskTemplate) Render(expr string, name string) (string, error)

Directories

Path Synopsis
api
cli
env
util

Jump to

Keyboard shortcuts

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