Documentation
¶
Index ¶
- type ArgsModifier
- type Config
- type DefaultModifier
- type DefaultTool
- func (in *DefaultTool) ConfigureStateBackend(_, _ string, _ *console.StackRunBaseFragment_StateUrls) error
- func (in *DefaultTool) HasChanges() (bool, error)
- func (in *DefaultTool) Modifier(stage console.StepStage) Modifier
- func (in *DefaultTool) Output() ([]*console.StackOutputAttributes, error)
- func (in *DefaultTool) Plan() (*console.StackStateAttributes, error)
- func (in *DefaultTool) Scan() ([]*console.StackPolicyViolationAttributes, error)
- func (in *DefaultTool) State() (*console.StackStateAttributes, error)
- type EnvModifier
- type Modifier
- type PassthroughModifier
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgsModifier ¶
type Config ¶
type Config struct {
// WorkDir is the working directory for the tool.
WorkDir string
// ExecDir is the execution directory for the tool.
ExecDir string
// Variables is a JSON encoded string representing
// tool variables.
Variables *string
// Scanner is a security scanner. See [securityv1.Scanner] for more information.
Scanner securityv1.Scanner
// Run is a stack run that is being processed.
Run *stackrunv1.StackRun
ConsoleURL string
ConsoleToken string
}
type DefaultModifier ¶
type DefaultModifier struct{}
DefaultModifier implements Modifier interface.
func (*DefaultModifier) Args ¶
func (in *DefaultModifier) Args(args []string) []string
Args implements ArgsModifier interface.
func (*DefaultModifier) Env ¶
func (in *DefaultModifier) Env(env []string) []string
Env implements EnvModifier interface.
func (*DefaultModifier) WriteCloser ¶
func (in *DefaultModifier) WriteCloser() []io.WriteCloser
WriteCloser implements PassthroughModifier interface.
type DefaultTool ¶
type DefaultTool struct {
// Scanner is a security scanner. See [securityv1.Scanner] for more information.
Scanner securityv1.Scanner
}
DefaultTool implements Tool interface.
func (*DefaultTool) ConfigureStateBackend ¶
func (in *DefaultTool) ConfigureStateBackend(_, _ string, _ *console.StackRunBaseFragment_StateUrls) error
ConfigureStateBackend implements Tool interface.
func (*DefaultTool) HasChanges ¶
func (in *DefaultTool) HasChanges() (bool, error)
HasChanges implements Tool interface. The default implementation returns true (assumes changes exist). Tool-specific implementations should override this for deterministic detection.
func (*DefaultTool) Modifier ¶
func (in *DefaultTool) Modifier(stage console.StepStage) Modifier
Modifier implements Tool interface.
func (*DefaultTool) Output ¶
func (in *DefaultTool) Output() ([]*console.StackOutputAttributes, error)
Output implements Tool interface.
func (*DefaultTool) Plan ¶
func (in *DefaultTool) Plan() (*console.StackStateAttributes, error)
Plan implements Tool interface.
func (*DefaultTool) Scan ¶
func (in *DefaultTool) Scan() ([]*console.StackPolicyViolationAttributes, error)
Scan implements Tool interface.
func (*DefaultTool) State ¶
func (in *DefaultTool) State() (*console.StackStateAttributes, error)
State implements Tool interface.
type EnvModifier ¶
type Modifier ¶
type Modifier interface {
ArgsModifier
EnvModifier
PassthroughModifier
}
Modifier can do many different runtime modifications of the provided stack run steps. For example, it can alter arguments of the executable step command or provide a custom writer that can capture step command output.
func NewDefaultModifier ¶
func NewDefaultModifier() Modifier
func NewMultiModifier ¶
type PassthroughModifier ¶
type PassthroughModifier interface {
// WriteCloser provides a custom array of [io.WriteCloser].
// Related stack run step output will be proxied all of them.
WriteCloser() []io.WriteCloser
}
type Tool ¶
type Tool interface {
// Scan tries to scan the state/plan information based on local files.
Scan() ([]*console.StackPolicyViolationAttributes, error)
// Plan tries to assemble plan information based on local files
// created by specific tool after PLAN stage. It then transforms it
// into gqlclient.StackStateAttributes.
Plan() (*console.StackStateAttributes, error)
// State tries to assemble state/plan information based on local files
// created by specific tool after all steps are finished running. It then
// transforms this information into gqlclient.StackStateAttributes.
State() (*console.StackStateAttributes, error)
// Output tries to find any available outputs information based on local files
// created by specific tool after all steps are finished running. It then
// transforms this information into gqlclient.StackOutputAttributes.
Output() ([]*console.StackOutputAttributes, error)
// ConfigureStateBackend manages the configuration of remote backend if
// supported by specific tool.
ConfigureStateBackend(actor, deployToken string, urls *console.StackRunBaseFragment_StateUrls) error
// Modifier returns specific modifier implementation based on the
// current step stage. Modifiers can for example alter arguments of the
// executable step command.
Modifier(stage console.StepStage) Modifier
// HasChanges deterministically checks if the plan contains any changes.
// Returns true if changes are detected, false for no-op plans.
// This allows the harness to skip unnecessary apply steps and not wait for approvals to free up resources.
HasChanges() (bool, error)
}
Tool handles one of the supported infrastructure management tools. List of supported tools is based on the gqlclient.StackType. It is mainly responsible for: - gathering state/plan information after successful run from local files - gathering any available outputs from local files - providing runtime modifiers to alter step command execution arguments, env, etc.