exec

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// CodeEmbeddedBash is the linter code for when a bash -c command is found.
	CodeEmbeddedBash linter.Code = "exec-100"

	// CodeBashCArgMissingQuotes is the linter code for when a bash -c flag argument is missing the required wrapping quotes.
	CodeBashCArgMissingQuotes linter.Code = "exec-101"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name  string
	Steps []Step // using UnmarshalYAML so that we don't need a custom type per action
}

func (Action) GetSteps

func (a Action) GetSteps() []builder.ExecutableStep

func (Action) MakeSteps

func (a Action) MakeSteps() interface{}

MakeSteps builds a slice of Steps for data to be unmarshaled into.

func (Action) MarshalYAML

func (a Action) MarshalYAML() (interface{}, error)

MarshalYAML converts the action back to a YAML representation install:

exec:
  ...
helm3:
  ...

func (*Action) UnmarshalYAML

func (a *Action) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML takes any yaml in this form ACTION: - exec: ... and puts the steps into the Action.Steps field

type Actions

type Actions []Action

Actions is a set of actions, and the steps, passed from Porter.

func (*Actions) UnmarshalYAML

func (a *Actions) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML takes chunks of a porter.yaml file associated with this mixin and populates it on the current action set. install:

exec:
  ...
exec:
  ...

upgrade:

exec:
  ...

type BuildInput

type BuildInput struct {

	// Actions is all the exec actions defined in the manifest
	Actions Actions `yaml:"actions"`
}

BuildInput represents stdin sent by porter to the build and lint commands

type ExecuteOptions

type ExecuteOptions struct {
	File string
}

ExecOptions represent the options for any exec command

type Instruction

type Instruction struct {
	Description     string            `yaml:"description"`
	Command         string            `yaml:"command"`
	WorkingDir      string            `yaml:"dir,omitempty"`
	Arguments       []string          `yaml:"arguments,omitempty"`
	SuffixArguments []string          `yaml:"suffix-arguments,omitempty"`
	Flags           builder.Flags     `yaml:"flags,omitempty"`
	EnvironmentVars map[string]string `yaml:"envs,omitempty"`
	Outputs         []Output          `yaml:"outputs,omitempty"`
	SuppressOutput  bool              `yaml:"suppress-output,omitempty"`

	// Allow the user to ignore some errors
	builder.IgnoreErrorHandler `yaml:"ignoreError,omitempty"`
}

type Mixin

type Mixin struct {
	// Config is a specialized portercontext.Context with additional runtime settings.
	Config runtime.RuntimeConfig

	// Debug specifies if the mixin should be in debug mode
	Debug bool
}

Mixin is the logic behind the exec mixin

func New

func New() *Mixin

New exec mixin client, initialized with useful defaults.

func (*Mixin) Close added in v1.0.1

func (m *Mixin) Close()

Close releases resources held by the mixin, such as our logging and tracing connections.

func (*Mixin) Execute

func (m *Mixin) Execute(ctx context.Context, opts ExecuteOptions) error

func (*Mixin) GetSchema

func (m *Mixin) GetSchema() string

func (*Mixin) Lint

func (m *Mixin) Lint(ctx context.Context) (linter.Results, error)

func (*Mixin) PrintLintResults

func (m *Mixin) PrintLintResults(ctx context.Context) error

func (*Mixin) PrintSchema

func (m *Mixin) PrintSchema()

func (*Mixin) PrintVersion

func (m *Mixin) PrintVersion(opts version.Options) error

type Output

type Output struct {
	Name     string `yaml:"name"`
	FilePath string `yaml:"path,omitempty"`
	JsonPath string `yaml:"jsonPath,omitempty"`
	Regex    string `yaml:"regex,omitempty"`
}

func (Output) GetFilePath

func (o Output) GetFilePath() string

func (Output) GetJsonPath

func (o Output) GetJsonPath() string

func (Output) GetName

func (o Output) GetName() string

func (Output) GetRegex

func (o Output) GetRegex() string

type Step

type Step struct {
	Instruction `yaml:"exec"`
}

func (Step) GetArguments

func (s Step) GetArguments() []string

func (Step) GetCommand

func (s Step) GetCommand() string

func (Step) GetEnvironmentVars added in v1.0.1

func (s Step) GetEnvironmentVars() map[string]string

func (Step) GetFlags

func (s Step) GetFlags() builder.Flags

func (Step) GetOutputs

func (s Step) GetOutputs() []builder.Output

func (Step) GetSuffixArguments added in v0.27.2

func (s Step) GetSuffixArguments() []string

func (Step) GetWorkingDir added in v0.38.0

func (s Step) GetWorkingDir() string

func (Step) SuppressesOutput

func (s Step) SuppressesOutput() bool

type TestMixin

type TestMixin struct {
	*Mixin
	TestConfig runtime.TestRuntimeConfig
}

func NewTestMixin

func NewTestMixin(t *testing.T) *TestMixin

NewTestMixin initializes an exec mixin, with the output buffered, and an in-memory file system.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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