Documentation
¶
Index ¶
- func RunAll(ctx context.Context, params *RunAllParams) error
- type Command
- type CommandGroup
- type EnvironmentConfiguration
- type ExecutionType
- type Feature
- type FeaturesProvider
- type FileMap
- type FileMapType
- type MockPlan
- func (mp *MockPlan) AddCommandGroup(commandGroups ...*CommandGroup) *MockPlan
- func (mp *MockPlan) AddDependsOn(dependencies ...string)
- func (mp *MockPlan) CommandGroups() []*CommandGroup
- func (mp *MockPlan) DependsOn() []string
- func (mp *MockPlan) EnvironmentConfiguration() *EnvironmentConfiguration
- func (mp *MockPlan) ID() string
- func (mp *MockPlan) WithID(id string) *MockPlan
- type MockPlanExecutor
- type Plan
- type PlanExecutor
- type PlansProvider
- type RunAllParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommandGroup ¶
type CommandGroup struct { Image string // Image to pull and run commands in. Ignored if BuildContext is set. Entrypoint Command // Entrypoint to run in container. Only used if BuildContext or Image is set. Commands []Command // Commands to run }
CommandGroup describes how to run a set of [Command]s. Commands run in a container if Image or BuildContext is set. Otherwise, commands run in a local shell.
type EnvironmentConfiguration ¶
type EnvironmentConfiguration struct { Env map[string]string // map of environment variables to set Stdout io.Writer // where to send stdout to Stderr io.Writer // where to send stderr to WorkingDir string // working directory to run commands from FileMaps []*FileMap // FileMaps to make available to commands Reuse bool // if true, reuse the same environment between executions }
EnvironmentConfiguration describes an environment to run commands in
type ExecutionType ¶
type ExecutionType string
ExecutionType allows the caller to force shell or docker execution of the action
const ( // ExecutionTypeShell configures commands to run in a local shell ExecutionTypeShell ExecutionType = "shell" // ExecutionTypeDocker configures commands to run in a Docker container ExecutionTypeDocker ExecutionType = "docker" // ExecutionTypeFinch configures commands to run in a Finch container ExecutionTypeFinch ExecutionType = "finch" )
func DefaultExecutionType ¶
func DefaultExecutionType() ExecutionType
DefaultExecutionType determines the appropriate default
type Feature ¶
type Feature func(ctx context.Context, plan Plan, execution PlanExecutor) error
Feature applies a feature to a run plan before and/or after the execution
type FeaturesProvider ¶
FeaturesProvider returns a list of [Feature]s for a given Plan
type FileMap ¶
type FileMap struct { SourcePath string // TargetPath string Type FileMapType }
FileMap describes a mapping between a source path and a target path in the command runner
type FileMapType ¶
type FileMapType string
FileMapType describes the type of FileMap. Valid values are copy and mount.
const ( // FileMapTypeCopyInWithGitignore copies files, excluding the .gitignore files FileMapTypeCopyInWithGitignore FileMapType = "copy_in_with_gitignore" // FileMapTypeCopyIn copies files FileMapTypeCopyIn FileMapType = "copy_in" // FileMapTypeBind mounts a directory FileMapTypeBind FileMapType = "bind" // FileMapTypeCopyOut copies files out of a container FileMapTypeCopyOut FileMapType = "copy_out" )
type MockPlan ¶
type MockPlan struct {
// contains filtered or unexported fields
}
MockPlan provides a mock plan
func (*MockPlan) AddCommandGroup ¶
func (mp *MockPlan) AddCommandGroup(commandGroups ...*CommandGroup) *MockPlan
AddCommandGroup provides access to add a new commandGroup
func (*MockPlan) AddDependsOn ¶
AddDependsOn provides access to add a new dependency
func (*MockPlan) CommandGroups ¶
func (mp *MockPlan) CommandGroups() []*CommandGroup
CommandGroups provides access to the [CommandGroups] for this plan
func (*MockPlan) EnvironmentConfiguration ¶
func (mp *MockPlan) EnvironmentConfiguration() *EnvironmentConfiguration
EnvironmentConfiguration provides access to the [EnviromentConfiguration] for this plan
type MockPlanExecutor ¶
MockPlanExecutor provides a mechanism to test Feature execution
func (*MockPlanExecutor) Execute ¶
func (m *MockPlanExecutor) Execute(ctx context.Context, feature Feature) error
Execute executes the provided feature with the provided plan
func (*MockPlanExecutor) OnExecute ¶
func (m *MockPlanExecutor) OnExecute(ctx interface{}) *mock.Call
OnExecute provides a mechanism to mock the call to Execute()
func (*MockPlanExecutor) WithExecutor ¶
func (m *MockPlanExecutor) WithExecutor(executor common.Executor) *MockPlanExecutor
WithExecutor allows you to test a feature with a given executor providing behaviors wrapped by the Feature
func (*MockPlanExecutor) WithPlan ¶
func (m *MockPlanExecutor) WithPlan(plan Plan) *MockPlanExecutor
WithPlan uses the provided plan during execution
type Plan ¶
type Plan interface { EnvironmentConfiguration() *EnvironmentConfiguration CommandGroups() []*CommandGroup ID() string DependsOn() []string AddDependsOn(...string) }
Plan describes how the [Runner] should run
type PlanExecutor ¶
PlanExecutor describes the execution argument passed to a Feature
type PlansProvider ¶
PlansProvider returns a list of [Plan]s
type RunAllParams ¶
type RunAllParams struct { Namespace string // namespace for this execution Plans PlansProvider // provider for the list of plans to run Features FeaturesProvider // provider for the features to apply to each plan Concurrency int // number of plans to run concurrently ExecutionType ExecutionType // executor to use for running commands }
RunAllParams contains the input parameters for the RunAll function