Documentation ¶
Overview ¶
Package server is the main package for Atlantis. It handles the web server and executing commands that come in via pull request comments.
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type ApplyExecutor
- type Command
- type CommandContext
- type CommandExtraArguments
- type CommandHandler
- type CommandName
- type CommandResponse
- type CommonData
- type ConcurrentRunLocker
- type ConfigReader
- type ErrData
- type EventParser
- func (e *EventParser) DetermineCommand(comment *github.IssueCommentEvent) (*Command, error)
- func (e *EventParser) ExtractCommentData(comment *github.IssueCommentEvent, ctx *CommandContext) error
- func (e *EventParser) ExtractPullData(pull *github.PullRequest) (models.PullRequest, models.Repo, error)
- func (e *EventParser) ExtractRepoData(ghRepo *github.Repository) (models.Repo, error)
- type FailureData
- type GithubCommentRenderer
- type GithubStatus
- type HelpExecutor
- type PlanExecutor
- type PlanSuccess
- type PreApply
- type PrePlan
- type ProjectConfig
- type ProjectConfigYaml
- type ProjectResult
- type PullClosedExecutor
- type RequestLogger
- type ResultData
- type Server
- type ServerConfig
- type Status
- type Workspace
Constants ¶
const ProjectConfigFile = "atlantis.yaml"
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type ApplyExecutor ¶
type ApplyExecutor struct {
// contains filtered or unexported fields
}
type Command ¶
type Command struct { Verbose bool Environment string Name CommandName }
type CommandContext ¶
type CommandExtraArguments ¶
type CommandHandler ¶
type CommandHandler struct {
// contains filtered or unexported fields
}
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 Command CommandName }
type CommonData ¶
type ConcurrentRunLocker ¶
type ConcurrentRunLocker struct {
// contains filtered or unexported fields
}
ConcurrentRunLocker is used to prevent multiple runs and commands from occurring at the same time for a single repo, pull, and environment
func NewConcurrentRunLocker ¶
func NewConcurrentRunLocker() *ConcurrentRunLocker
func (*ConcurrentRunLocker) TryLock ¶
func (c *ConcurrentRunLocker) TryLock(repoFullName string, env string, pullNum int) bool
TryLock returns true if you acquired the lock and false if someone else already has the lock
func (*ConcurrentRunLocker) Unlock ¶
func (c *ConcurrentRunLocker) Unlock(repoFullName, env string, pullNum int)
Unlock unlocks the repo and environment
type ConfigReader ¶
type ConfigReader struct{}
func (*ConfigReader) Exists ¶
func (c *ConfigReader) Exists(execPath string) bool
func (*ConfigReader) Read ¶
func (c *ConfigReader) Read(execPath string) (ProjectConfig, error)
type ErrData ¶
type ErrData struct { Error string CommonData }
type EventParser ¶
type EventParser struct {
GithubUser string
}
func (*EventParser) DetermineCommand ¶
func (e *EventParser) DetermineCommand(comment *github.IssueCommentEvent) (*Command, error)
func (*EventParser) ExtractCommentData ¶
func (e *EventParser) ExtractCommentData(comment *github.IssueCommentEvent, ctx *CommandContext) 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 FailureData ¶
type FailureData struct { Failure string CommonData }
type GithubCommentRenderer ¶
type GithubCommentRenderer struct{}
GithubCommentRenderer renders responses as GitHub comments
type GithubStatus ¶
type GithubStatus struct {
// contains filtered or unexported fields
}
func (*GithubStatus) Update ¶
func (g *GithubStatus) Update(repo models.Repo, pull models.PullRequest, status Status, step string) error
func (*GithubStatus) UpdateProjectResult ¶
func (g *GithubStatus) UpdateProjectResult(ctx *CommandContext, projectResults []ProjectResult) error
type HelpExecutor ¶
type HelpExecutor struct {
// contains filtered or unexported fields
}
type PlanExecutor ¶
type PlanExecutor struct { // LockURL is a function that given a lock id will return a url for lock view LockURL func(id string) (url string) // contains filtered or unexported fields }
PlanExecutor handles everything related to running terraform plan including integration with S3, Terraform, and GitHub
func (*PlanExecutor) ModifiedProjects ¶
func (p *PlanExecutor) ModifiedProjects(repoFullName string, modifiedFiles []string) []models.Project
ModifiedProjects returns the list of Terraform projects that have been changed due to the modified files
type PlanSuccess ¶
type ProjectConfig ¶
type ProjectConfig struct { PrePlan PrePlan PreApply PreApply // TerraformVersion is the version specified in the config file or nil if version wasn't specified TerraformVersion *version.Version ExtraArguments []CommandExtraArguments }
func (*ProjectConfig) GetExtraArguments ¶
func (c *ProjectConfig) GetExtraArguments(command string) []string
type ProjectConfigYaml ¶
type ProjectConfigYaml struct { PrePlan PrePlan `yaml:"pre_plan"` PreApply PreApply `yaml:"pre_apply"` TerraformVersion string `yaml:"terraform_version"` ExtraArguments []CommandExtraArguments `yaml:"extra_arguments"` }
type ProjectResult ¶
type ProjectResult struct { Path string Error error Failure string PlanSuccess *PlanSuccess ApplySuccess string }
func (ProjectResult) Status ¶
func (p ProjectResult) Status() Status
type PullClosedExecutor ¶
type PullClosedExecutor struct {
// contains filtered or unexported fields
}
func (*PullClosedExecutor) CleanUpPull ¶
func (p *PullClosedExecutor) CleanUpPull(repo models.Repo, pull models.PullRequest) error
type RequestLogger ¶
type RequestLogger struct {
// contains filtered or unexported fields
}
RequestLogger logs requests and their response codes
func NewRequestLogger ¶
func NewRequestLogger(logger *logging.SimpleLogger) *RequestLogger
func (*RequestLogger) ServeHTTP ¶
func (l *RequestLogger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type ResultData ¶
type ResultData struct { Results map[string]string CommonData }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens for GitHub events and runs the necessary Atlantis command
func NewServer ¶
func NewServer(config ServerConfig) (*Server, error)
type ServerConfig ¶
type ServerConfig struct { AWSRegion string `mapstructure:"aws-region"` AssumeRole string `mapstructure:"aws-assume-role-arn"` AtlantisURL string `mapstructure:"atlantis-url"` DataDir string `mapstructure:"data-dir"` GithubHostname string `mapstructure:"gh-hostname"` GithubToken string `mapstructure:"gh-token"` GithubUser string `mapstructure:"gh-user"` LogLevel string `mapstructure:"log-level"` Port int `mapstructure:"port"` RequireApproval bool `mapstructure:"require-approval"` }
the mapstructure tags correspond to flags in cmd/server.go
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
func (*Workspace) GetWorkspace ¶
func (w *Workspace) GetWorkspace(ctx *CommandContext) (string, error)