Documentation ¶
Overview ¶
Package runtime holds code for actually running commands vs. preparing and constructing.
Index ¶
- func GetPlanFilename(workspace string, projName string) string
- func IsRemotePlan(planContents []byte) bool
- func MustConstraint(constraint string) version.Constraints
- func ProjectNameFromPlanfile(workspace string, filename string) (string, error)
- func StripRefreshingFromPlanOutput(output string, tfVersion *version.Version) string
- type ApplyStepRunner
- type AsyncTFExec
- type DefaultPostWorkflowHookRunner
- type DefaultPreWorkflowHookRunner
- type EnvStepRunner
- type Executor
- type ExecutorVersionEnsurer
- type InitStepRunner
- type MultiEnvStepRunner
- type NullRunner
- type PostWorkflowHookRunner
- type PreWorkflowHookRunner
- type PullApprovedChecker
- type RemoteBackendUnsupportedRunner
- type RunStepRunner
- type Runner
- func NewImportStepRunner(terraformExecutor TerraformExec, defaultTfVersion *version.Version) Runner
- func NewMinimumVersionStepRunnerDelegate(minimumVersionStr string, defaultVersion *version.Version, delegate Runner) (Runner, error)
- func NewPlanStepRunner(terraformExecutor TerraformExec, defaultTfVersion *version.Version, ...) Runner
- func NewPlanTypeStepRunnerDelegate(defaultRunner Runner, remotePlanRunner Runner) Runner
- func NewPolicyCheckStepRunner(defaultTfVersion *version.Version, executorWorkflow VersionedExecutorWorkflow) (Runner, error)
- func NewShowStepRunner(executor TerraformExec, defaultTFVersion *version.Version) (Runner, error)
- func NewStateRmStepRunner(terraformExecutor TerraformExec, defaultTfVersion *version.Version) Runner
- func NewWorkspaceStepRunnerDelegate(terraformExecutor TerraformExec, defaultTfVersion *version.Version, ...) Runner
- type StatusUpdater
- type TerraformExec
- type VersionStepRunner
- type VersionedExecutorWorkflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPlanFilename ¶
GetPlanFilename returns the filename (not the path) of the generated tf plan given a workspace and project name.
func IsRemotePlan ¶
isRemotePlan returns true if planContents are from a plan that was generated using TFE remote operations.
func MustConstraint ¶
func MustConstraint(constraint string) version.Constraints
MustConstraint returns a constraint. It panics on error.
func ProjectNameFromPlanfile ¶
ProjectNameFromPlanfile returns the project name that a planfile with name filename is for. If filename is for a project without a name then it will return an empty string. workspace is the workspace this project is in.
Types ¶
type ApplyStepRunner ¶
type ApplyStepRunner struct { TerraformExecutor TerraformExec DefaultTFVersion *version.Version CommitStatusUpdater StatusUpdater AsyncTFExec AsyncTFExec }
ApplyStepRunner runs `terraform apply`.
type AsyncTFExec ¶
type AsyncTFExec interface { // RunCommandAsync runs terraform with args. It immediately returns an // input and output channel. Callers can use the output channel to // get the realtime output from the command. // Callers can use the input channel to pass stdin input to the command. // If any error is passed on the out channel, there will be no // further output (so callers are free to exit). RunCommandAsync(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *version.Version, workspace string) (chan<- string, <-chan runtimemodels.Line) }
AsyncTFExec brings the interface from TerraformClient into this package without causing circular imports. It's split from TerraformExec because due to a bug in pegomock with channels, we can't generate a mock for it so we hand-write it for this specific method.
type DefaultPostWorkflowHookRunner ¶ added in v0.18.2
type DefaultPostWorkflowHookRunner struct {
OutputHandler jobs.ProjectCommandOutputHandler
}
func (DefaultPostWorkflowHookRunner) Run ¶ added in v0.18.2
func (wh DefaultPostWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error)
type DefaultPreWorkflowHookRunner ¶
type DefaultPreWorkflowHookRunner struct {
OutputHandler jobs.ProjectCommandOutputHandler
}
func (DefaultPreWorkflowHookRunner) Run ¶
func (wh DefaultPreWorkflowHookRunner) Run(ctx models.WorkflowHookCommandContext, command string, path string) (string, string, error)
type EnvStepRunner ¶
type EnvStepRunner struct {
RunStepRunner *RunStepRunner
}
EnvStepRunner set environment variables.
func (*EnvStepRunner) Run ¶
func (r *EnvStepRunner) Run(ctx command.ProjectContext, command string, value string, path string, envs map[string]string) (string, error)
Run runs the env step command. value is the value for the environment variable. If set this is returned as the value. Otherwise command is run and its output is the value returned.
type Executor ¶
type Executor interface {
Run(ctx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) (string, error)
}
Executor runs an executable with provided environment variables and arguments and returns stdout
type ExecutorVersionEnsurer ¶
type ExecutorVersionEnsurer interface {
EnsureExecutorVersion(log logging.SimpleLogging, v *version.Version) (string, error)
}
ExecutorVersionEnsurer ensures a given version exists and outputs a path to the executable
type InitStepRunner ¶
type InitStepRunner struct { TerraformExecutor TerraformExec DefaultTFVersion *version.Version }
InitStep runs `terraform init`.
type MultiEnvStepRunner ¶ added in v0.19.4
type MultiEnvStepRunner struct {
RunStepRunner *RunStepRunner
}
EnvStepRunner set environment variables.
func (*MultiEnvStepRunner) Run ¶ added in v0.19.4
func (r *MultiEnvStepRunner) Run(ctx command.ProjectContext, command string, path string, envs map[string]string) (string, error)
Run runs the multienv step command. The command must return a json string containing the array of name-value pairs that are being added as extra environment variables
type NullRunner ¶
type NullRunner struct{}
NullRunner is a runner that isn't configured for a given plan type but outputs nothing
type PostWorkflowHookRunner ¶ added in v0.18.2
type PreWorkflowHookRunner ¶
type PullApprovedChecker ¶
type PullApprovedChecker interface {
PullIsApproved(baseRepo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
}
type RemoteBackendUnsupportedRunner ¶
type RemoteBackendUnsupportedRunner struct{}
RemoteBackendUnsupportedRunner is a runner that is responsible for outputting that the remote backend is unsupported
type RunStepRunner ¶
type RunStepRunner struct { TerraformExecutor TerraformExec DefaultTFVersion *version.Version // TerraformBinDir is the directory where Atlantis downloads Terraform binaries. TerraformBinDir string ProjectCmdOutputHandler jobs.ProjectCommandOutputHandler }
RunStepRunner runs custom commands.
type Runner ¶
type Runner interface {
Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error)
}
Runner mirrors events.StepRunner as a way to bring it into this package
func NewImportStepRunner ¶ added in v0.22.3
func NewImportStepRunner(terraformExecutor TerraformExec, defaultTfVersion *version.Version) Runner
func NewPlanStepRunner ¶ added in v0.22.3
func NewPlanStepRunner(terraformExecutor TerraformExec, defaultTfVersion *version.Version, commitStatusUpdater StatusUpdater, asyncTFExec AsyncTFExec) Runner
func NewPolicyCheckStepRunner ¶
func NewPolicyCheckStepRunner(defaultTfVersion *version.Version, executorWorkflow VersionedExecutorWorkflow) (Runner, error)
NewPolicyCheckStepRunner creates a new step runner from an executor workflow
func NewShowStepRunner ¶
func NewShowStepRunner(executor TerraformExec, defaultTFVersion *version.Version) (Runner, error)
func NewStateRmStepRunner ¶ added in v0.23.0
func NewStateRmStepRunner(terraformExecutor TerraformExec, defaultTfVersion *version.Version) Runner
func NewWorkspaceStepRunnerDelegate ¶ added in v0.22.3
func NewWorkspaceStepRunnerDelegate(terraformExecutor TerraformExec, defaultTfVersion *version.Version, delegate Runner) Runner
type StatusUpdater ¶
type StatusUpdater interface {
UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error
}
StatusUpdater brings the interface from CommitStatusUpdater into this package without causing circular imports.
type TerraformExec ¶
type TerraformExec interface { RunCommandWithVersion(ctx command.ProjectContext, path string, args []string, envs map[string]string, v *version.Version, workspace string) (string, error) EnsureVersion(log logging.SimpleLogging, v *version.Version) error }
TerraformExec brings the interface from TerraformClient into this package without causing circular imports.
type VersionStepRunner ¶
type VersionStepRunner struct { TerraformExecutor TerraformExec DefaultTFVersion *version.Version }
VersionStepRunner runs a version command given a ctx
type VersionedExecutorWorkflow ¶
type VersionedExecutorWorkflow interface { ExecutorVersionEnsurer Executor }
VersionedExecutorWorkflow defines a versioned execution for a given project context
Source Files ¶
- apply_step_runner.go
- env_step_runner.go
- executor.go
- import_step_runner.go
- init_step_runner.go
- minimum_version_step_runner_delegate.go
- multienv_step_runner.go
- plan_step_runner.go
- plan_type_step_runner_delegate.go
- policy_check_step_runner.go
- post_workflow_hook_runner.go
- pre_workflow_hook_runner.go
- pull_approved_checker.go
- run_step_runner.go
- runtime.go
- show_step_runner.go
- state_rm_step_runner.go
- version_step_runner.go
- workspace_step_runner_delegate.go
Directories ¶
Path | Synopsis |
---|---|
mocks/matchers
Code generated by pegomock.
|
Code generated by pegomock. |
matchers
Code generated by pegomock.
|
Code generated by pegomock. |
mocks/matchers
Code generated by pegomock.
|
Code generated by pegomock. |
mocks/matchers
Code generated by pegomock.
|
Code generated by pegomock. |