Documentation
¶
Index ¶
- type AnalyzerOption
- type Error
- type Errors
- type Executable
- type ExecutionStrategy
- type Executor
- type ExecutorOption
- type Option
- func WithArgs(args []string) Option
- func WithDir(workingDirectory string) Option
- func WithEnv(env []string) Option
- func WithHook(lifecycle v1.Lifecycle, fn v1.HookFunction) Option
- func WithID(id string) Option
- func WithOutputAnalyzer(heuristics []OutputAnalyzerHeuristic, opts ...AnalyzerOption) Option
- func WithOutputSinks(sinks ...io.WriteCloser) Option
- func WithTimeout(timeout time.Duration) Option
- type OutputAnalyzer
- type OutputAnalyzerHeuristic
- type WaitFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyzerOption ¶
type AnalyzerOption func(*analyzerConfig)
AnalyzerOption is a functional option for configuring an OutputAnalyzer.
func StderrCheckForProvider ¶
func StderrCheckForProvider(provider console.StackType) AnalyzerOption
StderrCheckForProvider returns an AnalyzerOption that enables stderr checking only for providers where stderr reliably indicates errors (e.g. Terraform), and disables it for providers that write non-error output to stderr (e.g. Ansible).
func WithStderrCheck ¶
func WithStderrCheck(check bool) AnalyzerOption
WithStderrCheck enables or disables treating stderr output as an error.
type Executable ¶
type Executable interface {
ID() string
Run(ctx context.Context) error
Start(ctx context.Context) (WaitFn, error)
RunWithOutput(ctx context.Context) ([]byte, error)
RunStream(ctx context.Context, cb func([]byte)) error
Command() string
}
func NewExecutable ¶
func NewExecutable(command string, options ...Option) Executable
type ExecutionStrategy ¶
type ExecutionStrategy string
ExecutionStrategy defines how executables queue should be processed.
const ( ExecutionStrategyParallel ExecutionStrategy = "parallel" ExecutionStrategyOrdered ExecutionStrategy = "ordered" )
type Executor ¶
type Executor interface {
Start(ctx context.Context) error
Add(executable Executable) error
}
func NewExecutor ¶
func NewExecutor(errChan chan error, finishedChan chan struct{}, options ...ExecutorOption) Executor
type ExecutorOption ¶
type ExecutorOption func(*executor)
func WithExecutionStrategy ¶
func WithExecutionStrategy(strategy ExecutionStrategy) ExecutorOption
func WithPostRunFunc ¶
func WithPostRunFunc(fn func(string, error)) ExecutorOption
func WithPreRunFunc ¶
func WithPreRunFunc(fn func(string)) ExecutorOption
type Option ¶
type Option func(*executable)
func WithOutputAnalyzer ¶
func WithOutputAnalyzer(heuristics []OutputAnalyzerHeuristic, opts ...AnalyzerOption) Option
func WithOutputSinks ¶
func WithOutputSinks(sinks ...io.WriteCloser) Option
func WithTimeout ¶
type OutputAnalyzer ¶
type OutputAnalyzer interface {
Stdout() io.Writer
Stderr() io.Writer
// Detect scans the output for potential errors.
// It uses a custom heuristics to detect issues.
// It can result in a false positives.
//
// Note: Make sure that it is executed after Write
// has finished to ensure proper detection.
Detect() []error
}
OutputAnalyzer captures the command output and attempts to detect potential errors.
func NewOutputAnalyzer ¶
func NewOutputAnalyzer(heuristics []OutputAnalyzerHeuristic, opts ...AnalyzerOption) OutputAnalyzer
type OutputAnalyzerHeuristic ¶
func NewKeywordDetector ¶
func NewKeywordDetector() OutputAnalyzerHeuristic
Click to show internal directories.
Click to hide internal directories.