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 DefaultPreWorkflowHookRunner
- type EnvStepRunner
- type Executor
- type ExecutorVersionEnsurer
- type InitStepRunner
- type MinimumVersionStepRunnerDelegate
- type NullRunner
- type PlanStepRunner
- type PlanTypeStepRunnerDelegate
- type PolicyCheckStepRunner
- type PreWorkflowHookRunner
- type PullApprovedChecker
- type RemoteBackendUnsupportedRunner
- type RunStepRunner
- type Runner
- func NewMinimumVersionStepRunnerDelegate(minimumVersionStr string, defaultVersion *version.Version, delegate Runner) (Runner, error)
- 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)
- type ShowStepRunner
- type StatusUpdater
- type TerraformExec
- type VersionedExecutorWorkflow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPlanFilename ¶ added in v0.4.1
GetPlanFilename returns the filename (not the path) of the generated tf plan given a workspace and project name.
func IsRemotePlan ¶ added in v0.17.0
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 ¶ added in v0.7.0
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 CommitStatusUpdater StatusUpdater AsyncTFExec AsyncTFExec }
ApplyStepRunner runs `terraform apply`.
type AsyncTFExec ¶ added in v0.5.0
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(log logging.SimpleLogging, path string, args []string, envs map[string]string, v *version.Version, workspace string) (chan<- string, <-chan terraform.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 DefaultPreWorkflowHookRunner ¶ added in v0.17.0
type DefaultPreWorkflowHookRunner struct{}
func (DefaultPreWorkflowHookRunner) Run ¶ added in v0.17.0
func (wh DefaultPreWorkflowHookRunner) Run(ctx models.PreWorkflowHookCommandContext, command string, path string) (string, error)
type EnvStepRunner ¶ added in v0.9.0
type EnvStepRunner struct {
RunStepRunner *RunStepRunner
}
EnvStepRunner set environment variables.
func (*EnvStepRunner) Run ¶ added in v0.9.0
func (r *EnvStepRunner) Run(ctx models.ProjectCommandContext, 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 ¶ added in v0.17.0
type Executor interface {
Run(ctx models.ProjectCommandContext, executablePath string, envs map[string]string, workdir string) (string, error)
}
Executor runs an executable with provided environment variables and arguments and returns stdout
type ExecutorVersionEnsurer ¶ added in v0.17.0
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 MinimumVersionStepRunnerDelegate ¶ added in v0.17.0
type MinimumVersionStepRunnerDelegate struct {
// contains filtered or unexported fields
}
MinimumVersionStepRunnerDelegate ensures that a given step runner can't run unless the command version being used is greater than a provided minimum
type NullRunner ¶ added in v0.17.0
type NullRunner struct{}
NullRunner is a runner that isn't configured for a given plan type but outputs nothing
type PlanStepRunner ¶
type PlanStepRunner struct { TerraformExecutor TerraformExec DefaultTFVersion *version.Version CommitStatusUpdater StatusUpdater AsyncTFExec AsyncTFExec }
type PlanTypeStepRunnerDelegate ¶ added in v0.17.0
type PlanTypeStepRunnerDelegate struct {
// contains filtered or unexported fields
}
PlanTypeStepRunnerDelegate delegates based on the type of plan, ie. remote backend which doesn't support certain functions
type PolicyCheckStepRunner ¶ added in v0.17.0
type PolicyCheckStepRunner struct {
// contains filtered or unexported fields
}
PolicyCheckStepRunner runs a policy check command given a ctx
func (*PolicyCheckStepRunner) Run ¶ added in v0.17.0
func (p *PolicyCheckStepRunner) Run(ctx models.ProjectCommandContext, extraArgs []string, path string, envs map[string]string) (string, error)
Run ensures a given version for the executable, builds the args from the project context and then runs executable returning the result
type PreWorkflowHookRunner ¶ added in v0.16.0
type PullApprovedChecker ¶
type RemoteBackendUnsupportedRunner ¶ added in v0.17.0
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 }
RunStepRunner runs custom commands.
type Runner ¶ added in v0.17.0
type Runner interface {
Run(ctx models.ProjectCommandContext, extraArgs []string, path string, envs map[string]string) (string, error)
}
Runner mirrors events.StepRunner as a way to bring it into this package
func NewMinimumVersionStepRunnerDelegate ¶ added in v0.17.0
func NewPlanTypeStepRunnerDelegate ¶ added in v0.17.0
func NewPolicyCheckStepRunner ¶ added in v0.17.0
func NewPolicyCheckStepRunner(defaultTfVersion *version.Version, executorWorkflow VersionedExecutorWorkflow) (Runner, error)
NewPolicyCheckStepRunner creates a new step runner from an executor workflow
func NewShowStepRunner ¶ added in v0.17.0
func NewShowStepRunner(executor TerraformExec, defaultTFVersion *version.Version) (Runner, error)
type ShowStepRunner ¶ added in v0.17.0
type ShowStepRunner struct { TerraformExecutor TerraformExec DefaultTFVersion *version.Version }
ShowStepRunner runs terraform show on an existing plan file and outputs it to a json file
type StatusUpdater ¶ added in v0.5.0
type StatusUpdater interface {
UpdateProject(ctx models.ProjectCommandContext, cmdName models.CommandName, status models.CommitStatus, url string) error
}
StatusUpdater brings the interface from CommitStatusUpdater into this package without causing circular imports.
type TerraformExec ¶
type TerraformExec interface { RunCommandWithVersion(log logging.SimpleLogging, 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 VersionedExecutorWorkflow ¶ added in v0.17.0
type VersionedExecutorWorkflow interface { ExecutorVersionEnsurer Executor }
VersionedExecutorWorkflow defines a versioned execution for a given project context
Source Files ¶
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. |