deploy

package
v0.0.0-...-9364404 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidTaskSection = errors.New("invalid task section")

ErrInvalidTaskSection is returned if a section is invalid.

Functions

func ApplyDropIns

func ApplyDropIns(t *Task, dropins []*conf.DropIn, spec map[string]map[string]conf.OptionSpec) error

ApplyDropIns applies all dropins on t. It basically wraps conf.ApplyDropIns and re-creates the tasks meta-data.

func ApplyEnvironment

func ApplyEnvironment(tsk *Task) error

ApplyEnvironment applies environment variable substitution to all unit options. If tsk.Environment is nil, ApplyEnvironment tries to call LoadEnv(tsk) first. Note that ApplyEnvironment does not substitude variables in the tasks meta section.

func EvaluateConditions

func EvaluateConditions(t *Task) (*condition.Instance, error)

EvaluateConditions evalutes all conditions of a task. If any condition fails the condition is returned along with an error. If all conditions are met, EvalutateConditions returns nil, nil.

func LoadEnv

func LoadEnv(t *Task) error

LoadEnv loads all environment files specified in t.EnvironmentFiles and populates t.Environment.

func RegisterAllConditions

func RegisterAllConditions()

RegisterAllConditions registers all built-in conditions from the condition package.

func RegisterCondition

func RegisterCondition(cond condition.Condition)

RegisterCondition registers a new condition type for the task meta-section.

func TaskOptions

func TaskOptions() []conf.OptionSpec

TaskOptions returns a slice of OptionSpec that are allowed int he task meta section.

Types

type Task

type Task struct {

	// FileName is the name of the file that describes this task.
	FileName string

	// Directory holds the directory of the task.
	Directory string

	// Description is the tasks description.
	Description string

	// StartMasked is set to true if this task is disabled (masked)
	// by default.
	StartMasked bool

	// Disabled can be set to true to disable a task permanently.
	Disabled bool

	// EnvironmentFiles holds a list of environment files.
	EnvironmentFiles []string

	// Sections holds the tasks sections.
	Sections []conf.Section

	// Environment holds the parsed environment.
	Environment []string

	// Conditions is a list of conditions that must match.
	Conditions []condition.Instance
	// contains filtered or unexported fields
}

Task defines a deploy task.

func Decode

func Decode(filePath string, r io.Reader) (*Task, error)

Decode decodes a deploy task from r and uses the basename of name as the task's name.

func DecodeFile

func DecodeFile(filePath string) (*Task, error)

DecodeFile is like Decode but reads the task from filePath.

func (*Task) Clone

func (tsk *Task) Clone() *Task

Clone creates a deep copy of t.

func (*Task) Envsubst

func (tsk *Task) Envsubst(file, value string) (string, error)

Envsubst applies environment substition on value.

Jump to

Keyboard shortcuts

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