Documentation ¶
Index ¶
- Constants
- type ApplyExecutor
- type Command
- type CommandContext
- type CommandHandler
- type CommandName
- type CommandResponse
- type CommandRunner
- type CommonData
- type EnvLock
- type EnvLocker
- type ErrData
- type EventParser
- func (e *EventParser) DetermineCommand(comment *github.IssueCommentEvent) (*Command, error)
- func (e *EventParser) ExtractCommentData(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pull models.PullRequest, err error)
- func (e *EventParser) ExtractPullData(pull *github.PullRequest) (models.PullRequest, models.Repo, error)
- func (e *EventParser) ExtractRepoData(ghRepo *github.Repository) (models.Repo, error)
- type EventParsing
- type Executor
- type FailureData
- type FileWorkspace
- type GHStatusUpdater
- type GithubCommentRenderer
- type GithubStatus
- type HelpExecutor
- type Hook
- type LockURLGenerator
- type ModifiedProjectFinder
- type PlanExecutor
- type PlanSuccess
- type PreExecuteResult
- type ProjectConfig
- type ProjectConfigManager
- type ProjectConfigReader
- type ProjectFinder
- type ProjectPreExecute
- type ProjectPreExecutor
- type ProjectResult
- type PullCleaner
- type PullClosedExecutor
- type ResultData
- type Status
- type Workspace
Constants ¶
const ProjectConfigFile = "atlantis.yaml"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyExecutor ¶
type ApplyExecutor struct { Github github.Client Terraform *terraform.Client RequireApproval bool Run *run.Run Workspace Workspace ProjectPreExecute *ProjectPreExecute }
func (*ApplyExecutor) Execute ¶
func (a *ApplyExecutor) Execute(ctx *CommandContext) CommandResponse
type Command ¶
type Command struct { Name CommandName Environment string Verbose bool Flags []string }
type CommandContext ¶
type CommandHandler ¶
type CommandHandler struct { PlanExecutor Executor ApplyExecutor Executor HelpExecutor Executor LockURLGenerator LockURLGenerator GHClient github.Client GHStatus GHStatusUpdater EventParser EventParsing EnvLocker EnvLocker GHCommentRenderer *GithubCommentRenderer Logger *logging.SimpleLogger }
CommandHandler is the first step when processing a comment command.
func (*CommandHandler) ExecuteCommand ¶
func (c *CommandHandler) ExecuteCommand(ctx *CommandContext)
func (*CommandHandler) SetLockURL ¶
func (c *CommandHandler) SetLockURL(f func(id string) (url string))
type CommandName ¶
type CommandName int
const ( Apply CommandName = iota Plan Help )
func (CommandName) String ¶
func (c CommandName) String() string
type CommandResponse ¶
type CommandResponse struct { Error error Failure string ProjectResults []ProjectResult }
type CommandRunner ¶
type CommandRunner interface {
ExecuteCommand(ctx *CommandContext)
}
type CommonData ¶
type EnvLock ¶
type EnvLock struct {
// contains filtered or unexported fields
}
EnvLock is used to prevent multiple runs and commands from occurring at the same time for a single repo, pull, and environment
func NewEnvLock ¶
func NewEnvLock() *EnvLock
type ErrData ¶
type ErrData struct { Error string CommonData }
type EventParser ¶
func (*EventParser) DetermineCommand ¶
func (e *EventParser) DetermineCommand(comment *github.IssueCommentEvent) (*Command, error)
DetermineCommand parses the comment as an atlantis command. If it succeeds, it returns the command. Otherwise it returns error.
func (*EventParser) ExtractCommentData ¶
func (e *EventParser) ExtractCommentData(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pull models.PullRequest, err error)
func (*EventParser) ExtractPullData ¶
func (e *EventParser) ExtractPullData(pull *github.PullRequest) (models.PullRequest, models.Repo, error)
func (*EventParser) ExtractRepoData ¶
func (e *EventParser) ExtractRepoData(ghRepo *github.Repository) (models.Repo, error)
type EventParsing ¶
type EventParsing interface { DetermineCommand(comment *github.IssueCommentEvent) (*Command, error) ExtractCommentData(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pull models.PullRequest, err error) ExtractPullData(pull *github.PullRequest) (models.PullRequest, models.Repo, error) ExtractRepoData(ghRepo *github.Repository) (models.Repo, error) }
type Executor ¶
type Executor interface {
Execute(ctx *CommandContext) CommandResponse
}
type FailureData ¶
type FailureData struct { Failure string CommonData }
type FileWorkspace ¶
type FileWorkspace struct {
DataDir string
}
func (*FileWorkspace) Clone ¶
func (w *FileWorkspace) Clone( log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, env string) (string, error)
Clone git clones headRepo, checks out the branch and then returns the absolute path to the root of the cloned repo.
func (*FileWorkspace) Delete ¶
func (w *FileWorkspace) Delete(r models.Repo, p models.PullRequest) error
Delete deletes the workspace for this repo and pull
func (*FileWorkspace) GetWorkspace ¶
func (w *FileWorkspace) GetWorkspace(r models.Repo, p models.PullRequest, env string) (string, error)
type GHStatusUpdater ¶
type GHStatusUpdater interface { Update(repo models.Repo, pull models.PullRequest, status Status, cmd *Command) error UpdateProjectResult(ctx *CommandContext, res CommandResponse) error }
type GithubCommentRenderer ¶
type GithubCommentRenderer struct{}
GithubCommentRenderer renders responses as GitHub comments
func (*GithubCommentRenderer) Render ¶
func (g *GithubCommentRenderer) Render(res CommandResponse, cmdName CommandName, log string, verbose bool) string
Render formats the data into a string that can be commented back to GitHub. nolint: interfacer
type GithubStatus ¶
func (*GithubStatus) Update ¶
func (g *GithubStatus) Update(repo models.Repo, pull models.PullRequest, status Status, cmd *Command) error
func (*GithubStatus) UpdateProjectResult ¶
func (g *GithubStatus) UpdateProjectResult(ctx *CommandContext, res CommandResponse) error
type HelpExecutor ¶
type HelpExecutor struct{}
func (*HelpExecutor) Execute ¶
func (h *HelpExecutor) Execute(ctx *CommandContext) CommandResponse
type Hook ¶
type Hook struct {
Commands []string `yaml:"commands"`
}
Hook represents the commands that can be run at a certain stage.
type LockURLGenerator ¶
type ModifiedProjectFinder ¶
type PlanExecutor ¶
type PlanExecutor struct { Github github.Client Terraform terraform.Runner Locker locking.Locker LockURL func(id string) (url string) Run run.Runner Workspace Workspace ProjectPreExecute ProjectPreExecutor ModifiedProject ModifiedProjectFinder }
PlanExecutor handles everything related to running terraform plan including integration with S3, Terraform, and GitHub
func (*PlanExecutor) Execute ¶
func (p *PlanExecutor) Execute(ctx *CommandContext) CommandResponse
func (*PlanExecutor) SetLockURL ¶
func (p *PlanExecutor) SetLockURL(f func(id string) (url string))
type PlanSuccess ¶
type PreExecuteResult ¶
type PreExecuteResult struct { ProjectResult ProjectResult ProjectConfig ProjectConfig TerraformVersion *version.Version LockResponse locking.TryLockResponse }
type ProjectConfig ¶
type ProjectConfig struct { // PreInit is a slice of command strings to run prior to terraform init. PreInit []string // PreGet is a slice of command strings to run prior to terraform get. PreGet []string // PrePlan is a slice of command strings to run prior to terraform plan. PrePlan []string // PostPlan is a slice of command strings to run after terraform plan. PostPlan []string // PreApply is a slice of command strings to run prior to terraform apply. PreApply []string // PostApply is a slice of command strings to run after terraform apply. PostApply []string // TerraformVersion is the version specified in the config file or nil // if version wasn't specified. TerraformVersion *version.Version // contains filtered or unexported fields }
ProjectConfig is a more usable version of projectConfigYAML that we can return to our callers. It holds the config for a project.
func (*ProjectConfig) GetExtraArguments ¶
func (c *ProjectConfig) GetExtraArguments(command string) []string
GetExtraArguments returns the arguments that were specified to be appended to command in the project config file.
type ProjectConfigManager ¶
type ProjectConfigManager struct{}
ProjectConfigManager deals with project config files that users can use to specify additional behaviour around how Atlantis executes for a project.
func (*ProjectConfigManager) Exists ¶
func (c *ProjectConfigManager) Exists(projectPath string) bool
Exists returns true if an atlantis config file exists for the project at projectPath. projectPath is an absolute path to the project.
func (*ProjectConfigManager) Read ¶
func (c *ProjectConfigManager) Read(execPath string) (ProjectConfig, error)
Read attempts to read the project config file for the project at projectPath. NOTE: projectPath is not the path to the actual config file. Returns the parsed ProjectConfig or error if unable to read.
type ProjectConfigReader ¶
type ProjectConfigReader interface { // Exists returns true if a project config file exists at projectPath. Exists(projectPath string) bool // Read attempts to read the project config file for the project at projectPath. // NOTE: projectPath is not the path to the actual config file. // Returns the parsed ProjectConfig or error if unable to read. Read(projectPath string) (ProjectConfig, error) }
ProjectConfigReader implements reading project config.
type ProjectFinder ¶
type ProjectFinder struct{}
ProjectFinder identifies projects in a repo.
func (*ProjectFinder) FindModified ¶
func (p *ProjectFinder) FindModified(log *logging.SimpleLogger, modifiedFiles []string, repoFullName string) []models.Project
FindModified returns the list of projects that were modified based on the modifiedFiles. The list will be de-duplicated.
type ProjectPreExecute ¶
type ProjectPreExecute struct { Locker locking.Locker ConfigReader ProjectConfigReader Terraform terraform.Runner Run run.Runner }
func (*ProjectPreExecute) Execute ¶
func (p *ProjectPreExecute) Execute(ctx *CommandContext, repoDir string, project models.Project) PreExecuteResult
type ProjectPreExecutor ¶
type ProjectPreExecutor interface {
Execute(ctx *CommandContext, repoDir string, project models.Project) PreExecuteResult
}
type ProjectResult ¶
type ProjectResult struct { Path string Error error Failure string PlanSuccess *PlanSuccess ApplySuccess string }
func (ProjectResult) Status ¶
func (p ProjectResult) Status() Status
type PullCleaner ¶
type PullCleaner interface {
CleanUpPull(repo models.Repo, pull models.PullRequest) error
}
type PullClosedExecutor ¶
func (*PullClosedExecutor) CleanUpPull ¶
func (p *PullClosedExecutor) CleanUpPull(repo models.Repo, pull models.PullRequest) error
type ResultData ¶
type ResultData struct { Results map[string]string CommonData }
type Workspace ¶
type Workspace interface { // Clone git clones headRepo, checks out the branch and then returns the absolute // path to the root of the cloned repo. Clone(log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, env string) (string, error) GetWorkspace(r models.Repo, p models.PullRequest, env string) (string, error) Delete(r models.Repo, p models.PullRequest) error }
Source Files ¶
- apply_executor.go
- command_context.go
- command_handler.go
- command_name.go
- command_response.go
- env_lock.go
- event_parser.go
- executor.go
- github_comment_renderer.go
- github_status.go
- help_executor.go
- plan_executor.go
- project_config.go
- project_finder.go
- project_pre_execute.go
- project_result.go
- pull_closed_executor.go
- workspace.go
Directories ¶
Path | Synopsis |
---|---|
Package github provides convenience wrappers around the go-github package.
|
Package github provides convenience wrappers around the go-github package. |
Package locking handles locking projects when they have in-progress runs.
|
Package locking handles locking projects when they have in-progress runs. |
boltdb
Package boltdb provides a locking implementation using Bolt.
|
Package boltdb provides a locking implementation using Bolt. |
Package models holds all models that are needed across packages.
|
Package models holds all models that are needed across packages. |
Package run handles running commands prior and following the regular Atlantis commands.
|
Package run handles running commands prior and following the regular Atlantis commands. |
Package terraform handles the actual running of terraform commands
|
Package terraform handles the actual running of terraform commands |