Documentation ¶
Overview ¶
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Copyright 2017 HootSuite Media Inc.
Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.
Index ¶
- Constants
- Variables
- type ApplyExecutor
- type AtlantisWorkspace
- type AtlantisWorkspaceLocker
- type Command
- type CommandContext
- type CommandHandler
- type CommandName
- type CommandResponse
- type CommandRunner
- type CommentParseResult
- type CommentParser
- type CommentParsing
- type CommitStatusUpdater
- type CommonData
- type DefaultAtlantisWorkspaceLocker
- type DefaultCommitStatusUpdater
- type DefaultProjectFinder
- type DefaultProjectPreExecutor
- type ErrData
- type EventParser
- func (e *EventParser) ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pullNum int, err error)
- func (e *EventParser) ParseGithubPull(pull *github.PullRequest) (models.PullRequest, models.Repo, error)
- func (e *EventParser) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error)
- func (e *EventParser) ParseGitlabMergeCommentEvent(event gitlab.MergeCommentEvent) (baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
- func (e *EventParser) ParseGitlabMergeEvent(event gitlab.MergeEvent) (models.PullRequest, models.Repo, error)
- func (e *EventParser) ParseGitlabMergeRequest(mr *gitlab.MergeRequest) models.PullRequest
- type EventParsing
- type Executor
- type FailureData
- type FileWorkspace
- func (w *FileWorkspace) Clone(log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, ...) (string, error)
- func (w *FileWorkspace) Delete(r models.Repo, p models.PullRequest) error
- func (w *FileWorkspace) GetWorkspace(r models.Repo, p models.PullRequest, workspace string) (string, error)
- type GithubPullGetter
- type GitlabMergeRequestGetter
- type Hook
- type LockURLGenerator
- type MarkdownRenderer
- type PlanExecutor
- type PlanSuccess
- type PreExecuteResult
- type ProjectConfig
- type ProjectConfigManager
- type ProjectConfigReader
- type ProjectFinder
- type ProjectPreExecutor
- type ProjectResult
- type PullCleaner
- type PullClosedExecutor
- type RepoWhitelist
- type ResultData
Constants ¶
const ( WorkspaceFlagLong = "workspace" WorkspaceFlagShort = "w" DirFlagLong = "dir" DirFlagShort = "d" VerboseFlagLong = "verbose" VerboseFlagShort = "" )
const ProjectConfigFile = "atlantis.yaml"
ProjectConfigFile is the filename of Atlantis project config.
const Wildcard = "*"
Wildcard matches 0-n of all characters except commas.
Variables ¶
var DidYouMeanAtlantisComment = "Did you mean to use `atlantis` instead of `terraform`?"
var HelpComment = "```cmake\n" +
`atlantis
Terraform automation and collaboration for your team
Usage:
atlantis <command> [options] -- [terraform options]
Examples:
# run plan in the root directory passing the -target flag to terraform
atlantis plan -d . -- -target=resource
# apply the plan generated
atlantis apply -d .
Commands:
plan Runs 'terraform plan' for the changes in this pull request.
apply Runs 'terraform apply' on the plans generated by 'atlantis plan'.
help View help.
Flags:
-h, --help help for atlantis
Use "atlantis [command] --help" for more information about a command.
`
Functions ¶
This section is empty.
Types ¶
type ApplyExecutor ¶
type ApplyExecutor struct { VCSClient vcs.ClientProxy Terraform *terraform.DefaultClient RequireApproval bool Run *run.Run AtlantisWorkspace AtlantisWorkspace ProjectPreExecute *DefaultProjectPreExecutor Webhooks webhooks.Sender }
ApplyExecutor handles executing terraform apply.
func (*ApplyExecutor) Execute ¶
func (a *ApplyExecutor) Execute(ctx *CommandContext) CommandResponse
Execute executes apply for the ctx.
type AtlantisWorkspace ¶ added in v0.2.2
type AtlantisWorkspace 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, workspace string) (string, error) // GetWorkspace returns the path to the workspace for this repo and pull. GetWorkspace(r models.Repo, p models.PullRequest, workspace string) (string, error) // Delete deletes the workspace for this repo and pull. Delete(r models.Repo, p models.PullRequest) error }
AtlantisWorkspace handles the workspace on disk for running commands.
type AtlantisWorkspaceLocker ¶ added in v0.2.2
type AtlantisWorkspaceLocker interface { // TryLock tries to acquire a lock for this repo, workspace and pull. TryLock(repoFullName string, workspace string, pullNum int) bool // Unlock deletes the lock for this repo, workspace and pull. If there was no // lock it will do nothing. Unlock(repoFullName, workspace string, pullNum int) }
AtlantisWorkspaceLocker is used to prevent multiple commands from executing at the same time for a single repo, pull, and workspace. We need to prevent this from happening because a specific repo/pull/workspace has a single workspace on disk and we haven't written Atlantis (yet) to handle concurrent execution within this workspace. This locker is called AtlantisWorkspaceLocker to differentiate it from the Terraform concept of workspaces, not directories on disk managed by Atlantis.
type Command ¶
type Command struct { Name CommandName Workspace string Verbose bool Flags []string // Dir is the path relative to the repo root to run the command in. // If empty string then it wasn't specified. "." is the root of the repo. // Dir will never end in "/". Dir string }
type CommandContext ¶
type CommandContext struct { // BaseRepo is the repository that the pull request will be merged into. BaseRepo models.Repo // HeadRepo is the repository that is getting merged into the BaseRepo. // If the pull request branch is from the same repository then HeadRepo will // be the same as BaseRepo. // See https://help.github.com/articles/about-pull-request-merges/. HeadRepo models.Repo Pull models.PullRequest // User is the user that triggered this command. User models.User Command *Command Log *logging.SimpleLogger }
CommandContext represents the context of a command that came from a comment on a pull request.
type CommandHandler ¶
type CommandHandler struct { PlanExecutor Executor ApplyExecutor Executor LockURLGenerator LockURLGenerator VCSClient vcs.ClientProxy GithubPullGetter GithubPullGetter GitlabMergeRequestGetter GitlabMergeRequestGetter CommitStatusUpdater CommitStatusUpdater EventParser EventParsing AtlantisWorkspaceLocker AtlantisWorkspaceLocker MarkdownRenderer *MarkdownRenderer Logger logging.SimpleLogging // AllowForkPRs controls whether we operate on pull requests from forks. AllowForkPRs bool // AllowForkPRsFlag is the name of the flag that controls fork PR's. We use // this in our error message back to the user on a forked PR so they know // how to enable this functionality. AllowForkPRsFlag string }
CommandHandler is the first step when processing a comment command.
func (*CommandHandler) ExecuteCommand ¶
func (c *CommandHandler) ExecuteCommand(baseRepo models.Repo, headRepo models.Repo, user models.User, pullNum int, cmd *Command)
ExecuteCommand executes the command. If the repo is from GitHub, we don't use headRepo and instead make an API call to get the headRepo. This is because the caller is unable to pass in a headRepo since there's not enough data available on the initial webhook payload.
func (*CommandHandler) SetLockURL ¶
func (c *CommandHandler) SetLockURL(f func(id string) (url string))
SetLockURL sets a function that's used to return the URL for a lock.
type CommandName ¶
type CommandName int
CommandName is the type of command.
const ( Apply CommandName = iota Plan )
func (CommandName) String ¶
func (c CommandName) String() string
String returns the string representation of c.
type CommandResponse ¶
type CommandResponse struct { Error error Failure string ProjectResults []ProjectResult }
CommandResponse is the result of running a Command.
type CommandRunner ¶
type CommandRunner interface { // ExecuteCommand is the first step after a command request has been parsed. // It handles gathering additional information needed to execute the command // and then calling the appropriate services to finish executing the command. ExecuteCommand(baseRepo models.Repo, headRepo models.Repo, user models.User, pullNum int, cmd *Command) }
CommandRunner is the first step after a command request has been parsed.
type CommentParseResult ¶ added in v0.3.0
type CommentParseResult struct { // Command is the successfully parsed command. Will be nil if // CommentResponse or Ignore is set. Command *Command // CommentResponse is set when we should respond immediately to the command // for example for atlantis help. CommentResponse string // Ignore is set to true when we should just ignore this comment. Ignore bool }
CommentParseResult describes the result of parsing a comment as a command.
type CommentParser ¶ added in v0.3.0
type CommentParser struct { GithubUser string GithubToken string GitlabUser string GitlabToken string }
CommentParser implements CommentParsing
func (*CommentParser) Parse ¶ added in v0.3.0
func (e *CommentParser) Parse(comment string, vcsHost models.VCSHostType) CommentParseResult
Parse parses the comment as an Atlantis command.
Valid commands contain:
- The initial "executable" name, 'run' or 'atlantis' or '@GithubUser' where GithubUser is the API user Atlantis is running as.
- Then a command, either 'plan', 'apply', or 'help'.
- Then optional flags, then an optional separator '--' followed by optional extra flags to be appended to the terraform plan/apply command.
Examples: - atlantis help - run plan - @GithubUser plan -w staging - atlantis plan -w staging -d dir --verbose - atlantis plan --verbose -- -key=value -key2 value2
nolint: gocyclo
type CommentParsing ¶ added in v0.3.0
type CommentParsing interface { // Parse attempts to parse a pull request comment to see if it's an Atlantis // commmand. Parse(comment string, vcsHost models.VCSHostType) CommentParseResult }
CommentParsing handles parsing pull request comments.
type CommitStatusUpdater ¶ added in v0.2.0
type CommitStatusUpdater interface { // Update updates the status of the head commit of pull. Update(repo models.Repo, pull models.PullRequest, status vcs.CommitStatus, cmd *Command) error // UpdateProjectResult updates the status of the head commit given the // state of response. UpdateProjectResult(ctx *CommandContext, res CommandResponse) error }
CommitStatusUpdater updates the status of a commit with the VCS host. We set the status to signify whether the plan/apply succeeds.
type CommonData ¶
CommonData is data that all responses have.
type DefaultAtlantisWorkspaceLocker ¶ added in v0.2.2
type DefaultAtlantisWorkspaceLocker struct {
// contains filtered or unexported fields
}
DefaultAtlantisWorkspaceLocker implements AtlantisWorkspaceLocker.
func NewDefaultAtlantisWorkspaceLocker ¶ added in v0.2.2
func NewDefaultAtlantisWorkspaceLocker() *DefaultAtlantisWorkspaceLocker
NewDefaultAtlantisWorkspaceLocker is a constructor.
func (*DefaultAtlantisWorkspaceLocker) TryLock ¶ added in v0.2.2
func (d *DefaultAtlantisWorkspaceLocker) TryLock(repoFullName string, workspace string, pullNum int) bool
TryLock returns true if a lock is acquired for this repo, pull and workspace and false otherwise.
func (*DefaultAtlantisWorkspaceLocker) Unlock ¶ added in v0.2.2
func (d *DefaultAtlantisWorkspaceLocker) Unlock(repoFullName, workspace string, pullNum int)
Unlock unlocks the repo, pull and workspace.
type DefaultCommitStatusUpdater ¶ added in v0.2.0
type DefaultCommitStatusUpdater struct {
Client vcs.ClientProxy
}
DefaultCommitStatusUpdater implements CommitStatusUpdater.
func (*DefaultCommitStatusUpdater) Update ¶ added in v0.2.0
func (d *DefaultCommitStatusUpdater) Update(repo models.Repo, pull models.PullRequest, status vcs.CommitStatus, cmd *Command) error
Update updates the commit status.
func (*DefaultCommitStatusUpdater) UpdateProjectResult ¶ added in v0.2.0
func (d *DefaultCommitStatusUpdater) UpdateProjectResult(ctx *CommandContext, res CommandResponse) error
UpdateProjectResult updates the commit status based on the status of res.
type DefaultProjectFinder ¶ added in v0.2.1
type DefaultProjectFinder struct{}
DefaultProjectFinder implements ProjectFinder.
func (*DefaultProjectFinder) DetermineProjects ¶ added in v0.3.0
func (p *DefaultProjectFinder) DetermineProjects(log *logging.SimpleLogger, modifiedFiles []string, repoFullName string, repoDir string) []models.Project
DetermineProjects returns the list of projects that were modified based on the modifiedFiles. The list will be de-duplicated.
type DefaultProjectPreExecutor ¶ added in v0.2.1
type DefaultProjectPreExecutor struct { Locker locking.Locker ConfigReader ProjectConfigReader Terraform terraform.Client Run run.Runner }
DefaultProjectPreExecutor implements ProjectPreExecutor.
func (*DefaultProjectPreExecutor) Execute ¶ added in v0.2.1
func (p *DefaultProjectPreExecutor) Execute(ctx *CommandContext, repoDir string, project models.Project) PreExecuteResult
Execute executes the pre plan/apply tasks.
type ErrData ¶
type ErrData struct { Error string CommonData }
ErrData is data about an error response.
type EventParser ¶
type EventParser struct { GithubUser string GithubToken string GitlabUser string GitlabToken string }
func (*EventParser) ParseGithubIssueCommentEvent ¶ added in v0.2.0
func (e *EventParser) ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pullNum int, err error)
func (*EventParser) ParseGithubPull ¶ added in v0.2.0
func (e *EventParser) ParseGithubPull(pull *github.PullRequest) (models.PullRequest, models.Repo, error)
func (*EventParser) ParseGithubRepo ¶ added in v0.2.0
func (e *EventParser) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error)
func (*EventParser) ParseGitlabMergeCommentEvent ¶ added in v0.2.0
func (e *EventParser) ParseGitlabMergeCommentEvent(event gitlab.MergeCommentEvent) (baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseGitlabMergeCommentEvent creates Atlantis models out of a GitLab event.
func (*EventParser) ParseGitlabMergeEvent ¶ added in v0.2.0
func (e *EventParser) ParseGitlabMergeEvent(event gitlab.MergeEvent) (models.PullRequest, models.Repo, error)
func (*EventParser) ParseGitlabMergeRequest ¶ added in v0.2.0
func (e *EventParser) ParseGitlabMergeRequest(mr *gitlab.MergeRequest) models.PullRequest
type EventParsing ¶
type EventParsing interface { ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pullNum int, err error) ParseGithubPull(pull *github.PullRequest) (models.PullRequest, models.Repo, error) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error) ParseGitlabMergeEvent(event gitlab.MergeEvent) (models.PullRequest, models.Repo, error) ParseGitlabMergeCommentEvent(event gitlab.MergeCommentEvent) (baseRepo models.Repo, headRepo models.Repo, user models.User, err error) ParseGitlabMergeRequest(mr *gitlab.MergeRequest) models.PullRequest }
type Executor ¶
type Executor interface {
Execute(ctx *CommandContext) CommandResponse
}
Executor is the generic interface implemented by each command type: help, plan, and apply.
type FailureData ¶
type FailureData struct { Failure string CommonData }
FailureData is data about a failure response.
type FileWorkspace ¶
type FileWorkspace struct {
DataDir string
}
FileWorkspace implements AtlantisWorkspace with the file system.
func (*FileWorkspace) Clone ¶
func (w *FileWorkspace) Clone( log *logging.SimpleLogger, baseRepo models.Repo, headRepo models.Repo, p models.PullRequest, workspace 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, workspace string) (string, error)
GetWorkspace returns the path to the workspace for this repo and pull.
type GithubPullGetter ¶ added in v0.2.0
type GithubPullGetter interface { // GetPullRequest gets the pull request with id pullNum for the repo. GetPullRequest(repo models.Repo, pullNum int) (*github.PullRequest, error) }
GithubPullGetter makes API calls to get pull requests.
type GitlabMergeRequestGetter ¶ added in v0.2.0
type GitlabMergeRequestGetter interface { // GetMergeRequest gets the pull request with the id pullNum for the repo. GetMergeRequest(repoFullName string, pullNum int) (*gitlab.MergeRequest, error) }
GitlabMergeRequestGetter makes API calls to get merge requests.
type Hook ¶
type Hook struct {
Commands []string `yaml:"commands"`
}
Hook represents the commands that can be run at a certain stage.
type LockURLGenerator ¶
type LockURLGenerator interface { // SetLockURL takes a function that given a lock id, will return a url // to view that lock. SetLockURL(func(id string) (url string)) }
LockURLGenerator consumes lock URLs.
type MarkdownRenderer ¶ added in v0.2.0
type MarkdownRenderer struct{}
MarkdownRenderer renders responses as markdown.
func (*MarkdownRenderer) Render ¶ added in v0.2.0
func (m *MarkdownRenderer) Render(res CommandResponse, cmdName CommandName, log string, verbose bool) string
Render formats the data into a markdown string. nolint: interfacer
type PlanExecutor ¶
type PlanExecutor struct { VCSClient vcs.ClientProxy Terraform terraform.Client Locker locking.Locker LockURL func(id string) (url string) Run run.Runner Workspace AtlantisWorkspace ProjectPreExecute ProjectPreExecutor ProjectFinder ProjectFinder }
PlanExecutor handles everything related to running terraform plan.
func (*PlanExecutor) Execute ¶
func (p *PlanExecutor) Execute(ctx *CommandContext) CommandResponse
Execute executes terraform plan for the ctx.
func (*PlanExecutor) SetLockURL ¶
func (p *PlanExecutor) SetLockURL(f func(id string) (url string))
SetLockURL takes a function that given a lock id, will return a url to view that lock.
type PlanSuccess ¶
PlanSuccess is the result of a successful plan.
type PreExecuteResult ¶
type PreExecuteResult struct { ProjectResult ProjectResult ProjectConfig ProjectConfig TerraformVersion *version.Version LockResponse locking.TryLockResponse }
PreExecuteResult is the result of running the pre execute.
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, just to the // project root. // Returns the parsed ProjectConfig or error if unable to read. Read(projectPath string) (ProjectConfig, error) }
ProjectConfigReader implements reading project config.
type ProjectFinder ¶
type ProjectFinder interface { // DetermineProjects returns the list of projects that were modified based on // the modifiedFiles. The list will be de-duplicated. DetermineProjects(log *logging.SimpleLogger, modifiedFiles []string, repoFullName string, repoDir string) []models.Project }
ProjectFinder determines what are the terraform project(s) within a repo.
type ProjectPreExecutor ¶
type ProjectPreExecutor interface { // Execute executes the pre plan/apply tasks. Execute(ctx *CommandContext, repoDir string, project models.Project) PreExecuteResult }
ProjectPreExecutor executes before the plan and apply executors. It handles the setup tasks that are common to both plan and apply.
type ProjectResult ¶
type ProjectResult struct { Path string Error error Failure string PlanSuccess *PlanSuccess ApplySuccess string }
ProjectResult is the result of executing a plan/apply for a project.
func (ProjectResult) Status ¶
func (p ProjectResult) Status() vcs.CommitStatus
Status returns the vcs commit status of this project result.
type PullCleaner ¶
type PullCleaner interface { // CleanUpPull deletes the workspaces used by the pull request on disk // and deletes any locks associated with this pull request for all workspaces. CleanUpPull(repo models.Repo, pull models.PullRequest) error }
PullCleaner cleans up pull requests after they're closed/merged.
type PullClosedExecutor ¶
type PullClosedExecutor struct { Locker locking.Locker VCSClient vcs.ClientProxy Workspace AtlantisWorkspace }
PullClosedExecutor executes the tasks required to clean up a closed pull request.
func (*PullClosedExecutor) CleanUpPull ¶
func (p *PullClosedExecutor) CleanUpPull(repo models.Repo, pull models.PullRequest) error
CleanUpPull cleans up after a closed pull request.
type RepoWhitelist ¶ added in v0.3.2
type RepoWhitelist struct { // Whitelist is a comma separated list of rules with wildcards '*' allowed. Whitelist string }
RepoWhitelist implements checking if repos are whitelisted to be used with this Atlantis.
func (*RepoWhitelist) IsWhitelisted ¶ added in v0.3.2
func (r *RepoWhitelist) IsWhitelisted(repoFullName string, vcsHostname string) bool
IsWhitelisted returns true if this repo is in our whitelist and false otherwise.
type ResultData ¶
type ResultData struct { Results map[string]string CommonData }
ResultData is data about a successful response.
Source Files ¶
- apply_executor.go
- atlantis_workspace.go
- atlantis_workspace_locker.go
- command_context.go
- command_handler.go
- command_name.go
- command_response.go
- comment_parser.go
- commit_status_updater.go
- event_parser.go
- executor.go
- markdown_renderer.go
- plan_executor.go
- project_config.go
- project_finder.go
- project_pre_execute.go
- project_result.go
- pull_closed_executor.go
- repo_whitelist.go