variables

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnv added in v0.2.0

func AddEnv(envVars []string, key, value string) []string

AddEnv takes in a slice of env vars in key-value format and a new key-value string to it, taking care of possible overrides.

func ParseKeyValue added in v0.2.0

func ParseKeyValue(env string) (string, string)

ParseKeyValue parses a key-value type into its parts.

Types

type Collection added in v0.2.0

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

Collection is a collection of variables.

func NewCollection added in v0.2.0

func NewCollection() *Collection

NewCollection returns a new collection.

func ParseCommandLineBuildArgs added in v0.2.0

func ParseCommandLineBuildArgs(args []string, dotEnvMap map[string]string) (*Collection, error)

ParseCommandLineBuildArgs parses a slice of constant build args and returns a new collection.

func (*Collection) AddActive added in v0.2.0

func (c *Collection) AddActive(name string, variable Variable, override bool) Variable

AddActive adds and activates a variable in the collection. It returns the effective variable. The effective variable may be different from the one being added, when override is false.

func (*Collection) AsMap added in v0.3.0

func (c *Collection) AsMap() map[string]string

AsMap returns the constant variables (active and inactive) as a map.

func (*Collection) Expand added in v0.2.0

func (c *Collection) Expand(word string) string

Expand expands constant build args within the given word.

func (*Collection) Get added in v0.2.0

func (c *Collection) Get(name string) (Variable, bool, bool)

Get returns a variable by name.

func (*Collection) SortedActiveVariables added in v0.2.0

func (c *Collection) SortedActiveVariables() []string

SortedActiveVariables returns the active variable names in a sorted slice.

func (*Collection) SortedOverridingVariables added in v0.3.3

func (c *Collection) SortedOverridingVariables() []string

SortedOverridingVariables returns the overriding variable names in a sorted slice.

func (*Collection) WithBuiltinBuildArgs added in v0.2.0

func (c *Collection) WithBuiltinBuildArgs(target domain.Target, gitMeta *buildcontext.GitMetadata) *Collection

WithBuiltinBuildArgs returns a new collection containing the current variables together with builtin args. This operation does not modify the current collection.

func (*Collection) WithParseBuildArgs added in v0.2.0

func (c *Collection) WithParseBuildArgs(args []string, pncvf ProcessNonConstantVariableFunc) (*Collection, map[string]bool, error)

WithParseBuildArgs takes in a slice of build args to be parsed and returns another collection containing the current build args, together with the newly parsed build args. This operation does not modify the current collection.

func (*Collection) WithResetEnvVars added in v0.2.0

func (c *Collection) WithResetEnvVars() *Collection

WithResetEnvVars returns a copy of the current collection with all env vars removed. This operation does not modify the current collection.

type ProcessNonConstantVariableFunc added in v0.2.0

type ProcessNonConstantVariableFunc func(name string, expression string) (argState llb.State, ti dedup.TargetInput, argIndex int, err error)

ProcessNonConstantVariableFunc is a function which takes in an expression and turns it into a state, target intput and arg index.

type Variable

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

Variable is an object representing a build arg or an env var.

func NewConstant

func NewConstant(value string) Variable

NewConstant creates a new constant build arg.

func NewConstantEnvVar

func NewConstantEnvVar(value string) Variable

NewConstantEnvVar cretes a new constant env var.

func NewVariable

func NewVariable(state llb.State, targetInput dedup.TargetInput, argIndex int) Variable

NewVariable creates a new variable build arg.

func (Variable) BuildArgInput

func (v Variable) BuildArgInput(name string, defaultValue string) dedup.BuildArgInput

BuildArgInput returns the BuildArgInput for this variable.

func (Variable) ConstantValue

func (v Variable) ConstantValue() string

ConstantValue returns the value of the constant build arg.

func (Variable) IsConstant

func (v Variable) IsConstant() bool

IsConstant returns whether this build arg is constant.

func (Variable) IsEnvVar

func (v Variable) IsEnvVar() bool

IsEnvVar returns whether the variable is an env var.

func (Variable) VariableState

func (v Variable) VariableState() llb.State

VariableState returns the state that holds a file containing the expression result of the build arg.

Jump to

Keyboard shortcuts

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