Documentation ¶
Index ¶
- Constants
- Variables
- func RunAndEmitStats(commandName string, ctx command.ProjectContext, ...) command.ProjectResult
- func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home string, ...) error
- type ApplyCommandRunner
- type ApprovePoliciesCommandRunner
- type AutoMerger
- type AutoplanCommand
- type AzureDevopsPullGetter
- type CommandRequirementHandler
- type CommandRunner
- type CommandScopedStatsProjectCommandContextBuilder
- type CommentBuilder
- type CommentCommand
- type CommentCommandRunner
- type CommentParseResult
- type CommentParser
- func (e *CommentParser) BuildApplyComment(repoRelDir string, workspace string, project string, autoMergeDisabled bool) string
- func (e *CommentParser) BuildPlanComment(repoRelDir string, workspace string, project string, commentArgs []string) string
- func (e *CommentParser) HelpComment() string
- func (e *CommentParser) Parse(rawComment string, vcsHost models.VCSHostType) CommentParseResult
- type CommentParsing
- type CommitStatusUpdater
- type CustomStepRunner
- type DBUpdater
- type DefaultCommandRequirementHandler
- func (a *DefaultCommandRequirementHandler) ValidateApplyProject(repoDir string, ctx command.ProjectContext) (failure string, err error)
- func (a *DefaultCommandRequirementHandler) ValidateImportProject(repoDir string, ctx command.ProjectContext) (failure string, err error)
- func (a *DefaultCommandRequirementHandler) ValidatePlanProject(repoDir string, ctx command.ProjectContext) (failure string, err error)
- type DefaultCommandRunner
- type DefaultCommitStatusUpdater
- func (d *DefaultCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, ...) error
- func (d *DefaultCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, ...) error
- func (d *DefaultCommitStatusUpdater) UpdatePostWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, ...) error
- func (d *DefaultCommitStatusUpdater) UpdatePreWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, ...) error
- func (d *DefaultCommitStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, ...) error
- type DefaultDeleteLockCommand
- type DefaultPendingPlanFinder
- type DefaultPostWorkflowHooksCommandRunner
- type DefaultPreWorkflowHooksCommandRunner
- type DefaultProjectCommandBuilder
- func (p *DefaultProjectCommandBuilder) BuildApplyCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
- func (p *DefaultProjectCommandBuilder) BuildApprovePoliciesCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
- func (p *DefaultProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error)
- func (p *DefaultProjectCommandBuilder) BuildImportCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
- func (p *DefaultProjectCommandBuilder) BuildPlanCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
- func (p *DefaultProjectCommandBuilder) BuildStateRmCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
- func (p *DefaultProjectCommandBuilder) BuildVersionCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
- type DefaultProjectCommandContextBuilder
- type DefaultProjectCommandRunner
- func (p *DefaultProjectCommandRunner) Apply(ctx command.ProjectContext) command.ProjectResult
- func (p *DefaultProjectCommandRunner) ApprovePolicies(ctx command.ProjectContext) command.ProjectResult
- func (p *DefaultProjectCommandRunner) Import(ctx command.ProjectContext) command.ProjectResult
- func (p *DefaultProjectCommandRunner) Plan(ctx command.ProjectContext) command.ProjectResult
- func (p *DefaultProjectCommandRunner) PolicyCheck(ctx command.ProjectContext) command.ProjectResult
- func (p *DefaultProjectCommandRunner) StateRm(ctx command.ProjectContext) command.ProjectResult
- func (p *DefaultProjectCommandRunner) Version(ctx command.ProjectContext) command.ProjectResult
- type DefaultProjectFinder
- func (p *DefaultProjectFinder) DetermineProjects(log logging.SimpleLogging, modifiedFiles []string, repoFullName string, ...) []models.Project
- func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log logging.SimpleLogging, modifiedFiles []string, config valid.RepoCfg, ...) ([]valid.Project, error)
- func (p *DefaultProjectFinder) DetermineWorkspaceFromHCL(log logging.SimpleLogging, absRepoDir string) (string, error)
- type DefaultProjectLocker
- type DefaultWorkingDirLocker
- type DeleteLockCommand
- type DirNotExistErr
- type DrainStatus
- type Drainer
- type EnvStepRunner
- type EventParser
- func (e *EventParser) GetBitbucketCloudPullEventType(eventTypeHeader string) models.PullRequestEventType
- func (e *EventParser) GetBitbucketServerPullEventType(eventTypeHeader string) models.PullRequestEventType
- func (e *EventParser) ParseAPIPlanRequest(vcsHostType models.VCSHostType, repoFullName string, cloneURL string) (models.Repo, error)
- func (e *EventParser) ParseAzureDevopsPull(pull *azuredevops.GitPullRequest) (pullModel models.PullRequest, baseRepo models.Repo, headRepo models.Repo, ...)
- func (e *EventParser) ParseAzureDevopsPullEvent(event azuredevops.Event) (pull models.PullRequest, pullEventType models.PullRequestEventType, ...)
- func (e *EventParser) ParseAzureDevopsRepo(adRepo *azuredevops.GitRepository) (models.Repo, error)
- func (e *EventParser) ParseBitbucketCloudPullCommentEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, ...)
- func (e *EventParser) ParseBitbucketCloudPullEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, ...)
- func (e *EventParser) ParseBitbucketServerPullCommentEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, ...)
- func (e *EventParser) ParseBitbucketServerPullEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, ...)
- func (e *EventParser) ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) (baseRepo models.Repo, user models.User, pullNum int, err error)
- func (e *EventParser) ParseGithubPull(pull *github.PullRequest) (pullModel models.PullRequest, baseRepo models.Repo, headRepo models.Repo, ...)
- func (e *EventParser) ParseGithubPullEvent(pullEvent *github.PullRequestEvent) (pull models.PullRequest, pullEventType models.PullRequestEventType, ...)
- func (e *EventParser) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error)
- func (e *EventParser) ParseGitlabMergeRequest(mr *gitlab.MergeRequest, baseRepo models.Repo) models.PullRequest
- func (e *EventParser) ParseGitlabMergeRequestCommentEvent(event gitlab.MergeCommentEvent) (baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
- func (e *EventParser) ParseGitlabMergeRequestEvent(event gitlab.MergeEvent) (pull models.PullRequest, eventType models.PullRequestEventType, ...)
- func (e *EventParser) ParseGitlabMergeRequestUpdateEvent(event gitlab.MergeEvent) models.PullRequestEventType
- type EventParsing
- type FileWorkspace
- func (w *FileWorkspace) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, ...) (string, bool, error)
- func (w *FileWorkspace) Delete(r models.Repo, p models.PullRequest) error
- func (w *FileWorkspace) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) error
- func (w *FileWorkspace) GetPullDir(r models.Repo, p models.PullRequest) (string, error)
- func (w *FileWorkspace) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) (string, error)
- func (w *FileWorkspace) HasDiverged(log logging.SimpleLogging, cloneDir string) bool
- type GithubAppWorkingDir
- type GithubPullGetter
- type GitlabMergeRequestGetter
- type ImportCommandRunner
- type InstrumentedProjectCommandBuilder
- func (b *InstrumentedProjectCommandBuilder) BuildApplyCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
- func (b *InstrumentedProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error)
- func (b *InstrumentedProjectCommandBuilder) BuildImportCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
- func (b *InstrumentedProjectCommandBuilder) BuildPlanCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
- func (b *InstrumentedProjectCommandBuilder) BuildStateRmCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
- type InstrumentedProjectCommandRunner
- func (p *InstrumentedProjectCommandRunner) Apply(ctx command.ProjectContext) command.ProjectResult
- func (p *InstrumentedProjectCommandRunner) ApprovePolicies(ctx command.ProjectContext) command.ProjectResult
- func (p *InstrumentedProjectCommandRunner) Import(ctx command.ProjectContext) command.ProjectResult
- func (p *InstrumentedProjectCommandRunner) Plan(ctx command.ProjectContext) command.ProjectResult
- func (p *InstrumentedProjectCommandRunner) PolicyCheck(ctx command.ProjectContext) command.ProjectResult
- func (p *InstrumentedProjectCommandRunner) StateRm(ctx command.ProjectContext) command.ProjectResult
- type InstrumentedPullClosedExecutor
- type IntrumentedCommandRunner
- type JobMessageSender
- type JobURLSetter
- type LockURLGenerator
- type MarkdownRenderer
- type ModuleProjects
- type MultiEnvStepRunner
- type PendingPlan
- type PendingPlanFinder
- type PlanCommandRunner
- type PolicyCheckCommand
- type PolicyCheckCommandRunner
- type PolicyCheckProjectCommandContextBuilder
- type PostWorkflowHookURLGenerator
- type PostWorkflowHooksCommandRunner
- type PreWorkflowHookURLGenerator
- type PreWorkflowHooksCommandRunner
- type ProjectApplyCommandBuilder
- type ProjectApplyCommandRunner
- type ProjectApprovePoliciesCommandBuilder
- type ProjectApprovePoliciesCommandRunner
- type ProjectCommandBuilder
- type ProjectCommandContextBuilder
- type ProjectCommandRunner
- type ProjectFinder
- type ProjectImportCommandBuilder
- type ProjectImportCommandRunner
- type ProjectLocker
- type ProjectOutputWrapper
- type ProjectPlanCommandBuilder
- type ProjectPlanCommandRunner
- type ProjectPolicyCheckCommandRunner
- type ProjectStateCommandBuilder
- type ProjectStateCommandRunner
- type ProjectVersionCommandBuilder
- type ProjectVersionCommandRunner
- type PullCleaner
- type PullCleanupTemplate
- type PullClosedEventTemplate
- type PullClosedExecutor
- type PullCommand
- type PullStatusFetcher
- type PullUpdater
- type RepoAllowlistChecker
- type ResourceCleaner
- type StateCommandRunner
- type StepRunner
- type TeamAllowlistChecker
- type TryLockResponse
- type UnlockCommandRunner
- type VarFileAllowlistChecker
- type VersionCommandRunner
- type WebhooksSender
- type WorkingDir
- type WorkingDirLocker
Constants ¶
const ( // DefaultRepoRelDir is the default directory we run commands in, relative // to the root of the repo. DefaultRepoRelDir = "." // DefaultWorkspace is the default Terraform workspace we run commands in. // This is also Terraform's default workspace. DefaultWorkspace = "default" // DefaultAutomergeEnabled is the default for the automerge setting. DefaultAutomergeEnabled = false // DefaultParallelApplyEnabled is the default for the parallel apply setting. DefaultParallelApplyEnabled = false // DefaultParallelPlanEnabled is the default for the parallel plan setting. DefaultParallelPlanEnabled = false // DefaultDeleteSourceBranchOnMerge being false is the default setting whether or not to remove a source branch on merge DefaultDeleteSourceBranchOnMerge = false )
const OperationComplete = true
const (
ShutdownComment = "Atlantis server is shutting down, please try again later."
)
const Wildcard = "*"
Wildcard matches 0-n of all characters except commas.
Variables ¶
var DidYouMeanAtlantisComment = "Did you mean to use `%s` instead of `%s`?"
DidYouMeanAtlantisComment is the comment we add to the pull request when someone runs a misspelled command or terraform instead of atlantis.
var UnlockUsage = "`Usage of unlock:`\n\n ```cmake\n" +
`%s unlock
Unlocks the entire PR and discards all plans in this PR.
Arguments or flags are not supported at the moment.
If you need to unlock a specific project please use the atlantis UI.` +
"\n```"
Functions ¶
func RunAndEmitStats ¶ added in v0.19.3
func RunAndEmitStats(commandName string, ctx command.ProjectContext, execute func(ctx command.ProjectContext) command.ProjectResult, scope tally.Scope) command.ProjectResult
func WriteGitCreds ¶ added in v0.9.0
func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home string, logger logging.SimpleLogging, ghAccessToken bool) error
WriteGitCreds generates a .git-credentials file containing the username and token used for authenticating with git over HTTPS It will create the file in home/.git-credentials If ghAccessToken is true we will look for a line starting with https://x-access-token and ending with gitHostname and replace it.
Types ¶
type ApplyCommandRunner ¶ added in v0.17.0
type ApplyCommandRunner struct { DisableApplyAll bool Backend locking.Backend // SilenceNoProjects is whether Atlantis should respond to PRs if no projects // are found SilenceNoProjects bool // contains filtered or unexported fields }
func NewApplyCommandRunner ¶ added in v0.17.0
func NewApplyCommandRunner( vcsClient vcs.Client, disableApplyAll bool, applyCommandLocker locking.ApplyLockChecker, commitStatusUpdater CommitStatusUpdater, prjCommandBuilder ProjectApplyCommandBuilder, prjCmdRunner ProjectApplyCommandRunner, autoMerger *AutoMerger, pullUpdater *PullUpdater, dbUpdater *DBUpdater, backend locking.Backend, parallelPoolSize int, SilenceNoProjects bool, silenceVCSStatusNoProjects bool, pullReqStatusFetcher vcs.PullReqStatusFetcher, ) *ApplyCommandRunner
func (*ApplyCommandRunner) IsLocked ¶ added in v0.17.0
func (a *ApplyCommandRunner) IsLocked() (bool, error)
func (*ApplyCommandRunner) Run ¶ added in v0.17.0
func (a *ApplyCommandRunner) Run(ctx *command.Context, cmd *CommentCommand)
type ApprovePoliciesCommandRunner ¶ added in v0.17.0
type ApprovePoliciesCommandRunner struct { // SilenceNoProjects is whether Atlantis should respond to PRs if no projects // are found SilenceNoProjects bool // contains filtered or unexported fields }
func NewApprovePoliciesCommandRunner ¶ added in v0.17.0
func NewApprovePoliciesCommandRunner( commitStatusUpdater CommitStatusUpdater, prjCommandBuilder ProjectApprovePoliciesCommandBuilder, prjCommandRunner ProjectApprovePoliciesCommandRunner, pullUpdater *PullUpdater, dbUpdater *DBUpdater, SilenceNoProjects bool, silenceVCSStatusNoProjects bool, vcsClient vcs.Client, ) *ApprovePoliciesCommandRunner
func (*ApprovePoliciesCommandRunner) Run ¶ added in v0.17.0
func (a *ApprovePoliciesCommandRunner) Run(ctx *command.Context, cmd *CommentCommand)
type AutoMerger ¶ added in v0.17.0
type AutoplanCommand ¶ added in v0.4.0
type AutoplanCommand struct{}
AutoplanCommand is a plan command that is automatically triggered when a pull request is opened or updated.
func (AutoplanCommand) CommandName ¶ added in v0.4.0
func (c AutoplanCommand) CommandName() command.Name
CommandName is plan.
func (AutoplanCommand) IsAutoplan ¶ added in v0.4.0
func (c AutoplanCommand) IsAutoplan() bool
IsAutoplan is true for autoplan commands (obviously).
func (AutoplanCommand) IsVerbose ¶ added in v0.4.0
func (c AutoplanCommand) IsVerbose() bool
IsVerbose is false for autoplan commands.
func (AutoplanCommand) SubCommandName ¶ added in v0.23.0
func (c AutoplanCommand) SubCommandName() string
SubCommandName is a subcommand for auto plan.
type AzureDevopsPullGetter ¶ added in v0.10.0
type AzureDevopsPullGetter interface { // GetPullRequest gets the pull request with id pullNum for the repo. GetPullRequest(repo models.Repo, pullNum int) (*azuredevops.GitPullRequest, error) }
AzureDevopsPullGetter makes API calls to get pull requests.
type CommandRequirementHandler ¶ added in v0.22.0
type CommandRequirementHandler interface { ValidatePlanProject(repoDir string, ctx command.ProjectContext) (string, error) ValidateApplyProject(repoDir string, ctx command.ProjectContext) (string, error) ValidateImportProject(repoDir string, ctx command.ProjectContext) (string, error) }
type CommandRunner ¶
type CommandRunner interface { // RunCommentCommand 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. RunCommentCommand(baseRepo models.Repo, maybeHeadRepo *models.Repo, maybePull *models.PullRequest, user models.User, pullNum int, cmd *CommentCommand) RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User) }
CommandRunner is the first step after a command request has been parsed.
type CommandScopedStatsProjectCommandContextBuilder ¶ added in v0.19.3
type CommandScopedStatsProjectCommandContextBuilder struct { ProjectCommandContextBuilder // Conciously making this global since it gets flushed periodically anyways ProjectCounter tally.Counter }
CommandScopedStatsProjectCommandContextBuilder ensures that project command context contains a scoped stats object relevant to the command it applies to.
func (*CommandScopedStatsProjectCommandContextBuilder) BuildProjectContext ¶ added in v0.19.3
func (cb *CommandScopedStatsProjectCommandContextBuilder) BuildProjectContext( ctx *command.Context, cmdName command.Name, subCmdName string, prjCfg valid.MergedProjectCfg, commentFlags []string, repoDir string, automerge, parallelApply, parallelPlan, verbose bool, terraformClient terraform.Client, ) (projectCmds []command.ProjectContext)
BuildProjectContext builds the context and injects the appropriate command level scope after the fact.
type CommentBuilder ¶ added in v0.4.5
type CommentBuilder interface { // BuildPlanComment builds a plan comment for the specified args. BuildPlanComment(repoRelDir string, workspace string, project string, commentArgs []string) string // BuildApplyComment builds an apply comment for the specified args. BuildApplyComment(repoRelDir string, workspace string, project string, autoMergeDisabled bool) string }
CommentBuilder builds comment commands that can be used on pull requests.
type CommentCommand ¶ added in v0.4.0
type CommentCommand struct { // RepoRelDir is the path relative to the repo root to run the command in. // Will never end in "/". If empty then the comment specified no directory. RepoRelDir string // Flags are the extra arguments appended to the comment, // ex. atlantis plan -- -target=resource Flags []string // Name is the name of the command the comment specified. Name command.Name // SubName is the name of the sub command the comment specified. SubName string // AutoMergeDisabled is true if the command should not automerge after apply. AutoMergeDisabled bool // Verbose is true if the command should output verbosely. Verbose bool // Workspace is the name of the Terraform workspace to run the command in. // If empty then the comment specified no workspace. Workspace string // ProjectName is the name of a project to run the command on. It refers to a // project specified in an atlantis.yaml file. // If empty then the comment specified no project. ProjectName string }
CommentCommand is a command that was triggered by a pull request comment.
func NewCommentCommand ¶ added in v0.4.0
func NewCommentCommand(repoRelDir string, flags []string, name command.Name, subName string, verbose, autoMergeDisabled bool, workspace string, project string) *CommentCommand
NewCommentCommand constructs a CommentCommand, setting all missing fields to defaults.
func (CommentCommand) CommandName ¶ added in v0.4.0
func (c CommentCommand) CommandName() command.Name
CommandName returns the name of this command.
func (CommentCommand) IsAutoplan ¶ added in v0.4.0
func (c CommentCommand) IsAutoplan() bool
IsAutoplan will be false for comment commands.
func (CommentCommand) IsForSpecificProject ¶ added in v0.4.5
func (c CommentCommand) IsForSpecificProject() bool
IsForSpecificProject returns true if the command is for a specific dir, workspace or project name. Otherwise it's a command like "atlantis plan" or "atlantis apply".
func (CommentCommand) IsVerbose ¶ added in v0.4.0
func (c CommentCommand) IsVerbose() bool
IsVerbose is true if the command should give verbose output.
func (CommentCommand) String ¶ added in v0.4.0
func (c CommentCommand) String() string
String returns a string representation of the command.
func (CommentCommand) SubCommandName ¶ added in v0.23.0
func (c CommentCommand) SubCommandName() string
SubCommandName returns the name of this subcommand.
type CommentCommandRunner ¶ added in v0.17.0
type CommentCommandRunner interface {
Run(*command.Context, *CommentCommand)
}
CommentCommandRunner runs individual command workflows.
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 *CommentCommand // 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 GitlabUser string BitbucketUser string AzureDevopsUser string ExecutableName string AllowCommands []command.Name }
CommentParser implements CommentParsing
func NewCommentParser ¶ added in v0.22.0
func NewCommentParser(githubUser, gitlabUser, bitbucketUser, azureDevopsUser, executableName string, allowCommands []command.Name) *CommentParser
NewCommentParser returns a CommentParser
func (*CommentParser) BuildApplyComment ¶ added in v0.4.5
func (e *CommentParser) BuildApplyComment(repoRelDir string, workspace string, project string, autoMergeDisabled bool) string
BuildApplyComment builds an apply comment for the specified args.
func (*CommentParser) BuildPlanComment ¶ added in v0.4.5
func (e *CommentParser) BuildPlanComment(repoRelDir string, workspace string, project string, commentArgs []string) string
BuildPlanComment builds a plan comment for the specified args.
func (*CommentParser) HelpComment ¶ added in v0.16.0
func (e *CommentParser) HelpComment() string
func (*CommentParser) Parse ¶ added in v0.3.0
func (e *CommentParser) Parse(rawComment 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: 'plan', 'apply', 'unlock', 'version, 'approve_policies', 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 apply - @GithubUser plan -w staging - atlantis plan -w staging -d dir --verbose - atlantis plan --verbose -- -key=value -key2 value2 - atlantis unlock - atlantis version - atlantis approve_policies - atlantis import ADDRESS ID
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 // command. Parse(comment string, vcsHost models.VCSHostType) CommentParseResult }
CommentParsing handles parsing pull request comments.
type CommitStatusUpdater ¶ added in v0.2.0
type CommitStatusUpdater interface { // UpdateCombined updates the combined status of the head commit of pull. // A combined status represents all the projects modified in the pull. UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name) error // UpdateCombinedCount updates the combined status to reflect the // numSuccess out of numTotal. UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name, numSuccess int, numTotal int) error UpdatePreWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) error UpdatePostWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) error }
CommitStatusUpdater updates the status of a commit with the VCS host. We set the status to signify whether the plan/apply succeeds.
type CustomStepRunner ¶ added in v0.7.0
type CustomStepRunner interface { // Run cmd in path. Run(ctx command.ProjectContext, cmd string, path string, envs map[string]string, streamOutput bool) (string, error) }
CustomStepRunner runs custom run steps.
type DefaultCommandRequirementHandler ¶ added in v0.22.0
type DefaultCommandRequirementHandler struct {
WorkingDir WorkingDir
}
func (*DefaultCommandRequirementHandler) ValidateApplyProject ¶ added in v0.22.0
func (a *DefaultCommandRequirementHandler) ValidateApplyProject(repoDir string, ctx command.ProjectContext) (failure string, err error)
func (*DefaultCommandRequirementHandler) ValidateImportProject ¶ added in v0.22.0
func (a *DefaultCommandRequirementHandler) ValidateImportProject(repoDir string, ctx command.ProjectContext) (failure string, err error)
func (*DefaultCommandRequirementHandler) ValidatePlanProject ¶ added in v0.23.0
func (a *DefaultCommandRequirementHandler) ValidatePlanProject(repoDir string, ctx command.ProjectContext) (failure string, err error)
type DefaultCommandRunner ¶ added in v0.4.0
type DefaultCommandRunner struct { VCSClient vcs.Client GithubPullGetter GithubPullGetter AzureDevopsPullGetter AzureDevopsPullGetter GitlabMergeRequestGetter GitlabMergeRequestGetter DisableAutoplan bool EventParser EventParsing Logger logging.SimpleLogging GlobalCfg valid.GlobalCfg StatsScope tally.Scope // AllowForkPRs controls whether we operate on pull requests from forks. AllowForkPRs bool // ParallelPoolSize controls the size of the wait group used to run // parallel plans and applies (if enabled). ParallelPoolSize int // 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 // SilenceForkPRErrors controls whether to comment on Fork PRs when AllowForkPRs = False SilenceForkPRErrors bool // SilenceForkPRErrorsFlag 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 disable error comment SilenceForkPRErrorsFlag string CommentCommandRunnerByCmd map[command.Name]CommentCommandRunner Drainer *Drainer PreWorkflowHooksCommandRunner PreWorkflowHooksCommandRunner PostWorkflowHooksCommandRunner PostWorkflowHooksCommandRunner PullStatusFetcher PullStatusFetcher TeamAllowlistChecker *TeamAllowlistChecker VarFileAllowlistChecker *VarFileAllowlistChecker }
DefaultCommandRunner is the first step when processing a comment command.
func (*DefaultCommandRunner) RunAutoplanCommand ¶ added in v0.4.0
func (c *DefaultCommandRunner) RunAutoplanCommand(baseRepo models.Repo, headRepo models.Repo, pull models.PullRequest, user models.User)
RunAutoplanCommand runs plan and policy_checks when a pull request is opened or updated.
func (*DefaultCommandRunner) RunCommentCommand ¶ added in v0.4.0
func (c *DefaultCommandRunner) RunCommentCommand(baseRepo models.Repo, maybeHeadRepo *models.Repo, maybePull *models.PullRequest, user models.User, pullNum int, cmd *CommentCommand)
RunCommentCommand executes the command. We take in a pointer for maybeHeadRepo because for some events there isn't enough data to construct the Repo model and callers might want to wait until the event is further validated before making an additional (potentially wasteful) call to get the necessary data.
type DefaultCommitStatusUpdater ¶ added in v0.2.0
type DefaultCommitStatusUpdater struct { Client vcs.Client // StatusName is the name used to identify Atlantis when creating PR statuses. StatusName string }
DefaultCommitStatusUpdater implements CommitStatusUpdater.
func (*DefaultCommitStatusUpdater) UpdateCombined ¶ added in v0.5.0
func (d *DefaultCommitStatusUpdater) UpdateCombined(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name) error
func (*DefaultCommitStatusUpdater) UpdateCombinedCount ¶ added in v0.5.0
func (d *DefaultCommitStatusUpdater) UpdateCombinedCount(repo models.Repo, pull models.PullRequest, status models.CommitStatus, cmdName command.Name, numSuccess int, numTotal int) error
func (*DefaultCommitStatusUpdater) UpdatePostWorkflowHook ¶ added in v0.22.0
func (d *DefaultCommitStatusUpdater) UpdatePostWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) error
func (*DefaultCommitStatusUpdater) UpdatePreWorkflowHook ¶ added in v0.22.0
func (d *DefaultCommitStatusUpdater) UpdatePreWorkflowHook(pull models.PullRequest, status models.CommitStatus, hookDescription string, runtimeDescription string, url string) error
func (*DefaultCommitStatusUpdater) UpdateProject ¶ added in v0.5.0
func (d *DefaultCommitStatusUpdater) UpdateProject(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, url string, result *command.ProjectResult) error
type DefaultDeleteLockCommand ¶ added in v0.14.0
type DefaultDeleteLockCommand struct { Locker locking.Locker Logger logging.SimpleLogging WorkingDir WorkingDir WorkingDirLocker WorkingDirLocker Backend locking.Backend }
DefaultDeleteLockCommand deletes a specific lock after a request from the LocksController.
func (*DefaultDeleteLockCommand) DeleteLock ¶ added in v0.14.0
func (l *DefaultDeleteLockCommand) DeleteLock(id string) (*models.ProjectLock, error)
DeleteLock handles deleting the lock at id
func (*DefaultDeleteLockCommand) DeleteLocksByPull ¶ added in v0.14.0
func (l *DefaultDeleteLockCommand) DeleteLocksByPull(repoFullName string, pullNum int) (int, error)
DeleteLocksByPull handles deleting all locks for the pull request
type DefaultPendingPlanFinder ¶ added in v0.4.14
type DefaultPendingPlanFinder struct{}
DefaultPendingPlanFinder finds unapplied plans.
func (*DefaultPendingPlanFinder) DeletePlans ¶ added in v0.4.14
func (p *DefaultPendingPlanFinder) DeletePlans(pullDir string) error
deletePlans deletes all plans in pullDir.
func (*DefaultPendingPlanFinder) Find ¶ added in v0.4.14
func (p *DefaultPendingPlanFinder) Find(pullDir string) ([]PendingPlan, error)
Find finds all pending plans in pullDir. pullDir should be the working directory where Atlantis will operate on this pull request. It's one level up from where Atlantis clones the repo for each workspace.
type DefaultPostWorkflowHooksCommandRunner ¶ added in v0.18.2
type DefaultPostWorkflowHooksCommandRunner struct { VCSClient vcs.Client WorkingDirLocker WorkingDirLocker WorkingDir WorkingDir GlobalCfg valid.GlobalCfg PostWorkflowHookRunner runtime.PostWorkflowHookRunner CommitStatusUpdater CommitStatusUpdater Router PostWorkflowHookURLGenerator }
DefaultPostWorkflowHooksCommandRunner is the first step when processing a workflow hook commands.
func (*DefaultPostWorkflowHooksCommandRunner) RunPostHooks ¶ added in v0.18.2
func (w *DefaultPostWorkflowHooksCommandRunner) RunPostHooks( ctx *command.Context, cmd *CommentCommand, ) error
RunPostHooks runs post_workflow_hooks after a plan/apply has completed
type DefaultPreWorkflowHooksCommandRunner ¶ added in v0.16.0
type DefaultPreWorkflowHooksCommandRunner struct { VCSClient vcs.Client WorkingDirLocker WorkingDirLocker WorkingDir WorkingDir GlobalCfg valid.GlobalCfg PreWorkflowHookRunner runtime.PreWorkflowHookRunner CommitStatusUpdater CommitStatusUpdater Router PreWorkflowHookURLGenerator }
DefaultPreWorkflowHooksCommandRunner is the first step when processing a workflow hook commands.
func (*DefaultPreWorkflowHooksCommandRunner) RunPreHooks ¶ added in v0.16.0
func (w *DefaultPreWorkflowHooksCommandRunner) RunPreHooks(ctx *command.Context, cmd *CommentCommand) error
RunPreHooks runs pre_workflow_hooks when PR is opened or updated.
type DefaultProjectCommandBuilder ¶ added in v0.4.0
type DefaultProjectCommandBuilder struct { ParserValidator *config.ParserValidator ProjectFinder ProjectFinder VCSClient vcs.Client WorkingDir WorkingDir WorkingDirLocker WorkingDirLocker GlobalCfg valid.GlobalCfg PendingPlanFinder *DefaultPendingPlanFinder ProjectCommandContextBuilder ProjectCommandContextBuilder SkipCloneNoChanges bool EnableRegExpCmd bool AutoDetectModuleFiles string AutoplanFileList string EnableDiffMarkdownFormat bool RestrictFileList bool SilenceNoProjects bool TerraformExecutor terraform.Client }
DefaultProjectCommandBuilder implements ProjectCommandBuilder. This class combines the data from the comment and any atlantis.yaml file or Atlantis server config and then generates a set of contexts.
func NewProjectCommandBuilder ¶ added in v0.17.0
func NewProjectCommandBuilder( policyChecksSupported bool, parserValidator *config.ParserValidator, projectFinder ProjectFinder, vcsClient vcs.Client, workingDir WorkingDir, workingDirLocker WorkingDirLocker, globalCfg valid.GlobalCfg, pendingPlanFinder *DefaultPendingPlanFinder, commentBuilder CommentBuilder, skipCloneNoChanges bool, EnableRegExpCmd bool, AutoDetectModuleFiles string, AutoplanFileList string, RestrictFileList bool, SilenceNoProjects bool, scope tally.Scope, logger logging.SimpleLogging, terraformClient terraform.Client, ) *DefaultProjectCommandBuilder
func (*DefaultProjectCommandBuilder) BuildApplyCommands ¶ added in v0.4.5
func (p *DefaultProjectCommandBuilder) BuildApplyCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
See ProjectCommandBuilder.BuildApplyCommands.
func (*DefaultProjectCommandBuilder) BuildApprovePoliciesCommands ¶ added in v0.17.0
func (p *DefaultProjectCommandBuilder) BuildApprovePoliciesCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
func (*DefaultProjectCommandBuilder) BuildAutoplanCommands ¶ added in v0.4.0
func (p *DefaultProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error)
See ProjectCommandBuilder.BuildAutoplanCommands.
func (*DefaultProjectCommandBuilder) BuildImportCommands ¶ added in v0.22.0
func (p *DefaultProjectCommandBuilder) BuildImportCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
func (*DefaultProjectCommandBuilder) BuildPlanCommands ¶ added in v0.4.5
func (p *DefaultProjectCommandBuilder) BuildPlanCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
See ProjectCommandBuilder.BuildPlanCommands.
func (*DefaultProjectCommandBuilder) BuildStateRmCommands ¶ added in v0.23.0
func (p *DefaultProjectCommandBuilder) BuildStateRmCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
func (*DefaultProjectCommandBuilder) BuildVersionCommands ¶ added in v0.17.3
func (p *DefaultProjectCommandBuilder) BuildVersionCommands(ctx *command.Context, cmd *CommentCommand) ([]command.ProjectContext, error)
type DefaultProjectCommandContextBuilder ¶ added in v0.17.0
type DefaultProjectCommandContextBuilder struct {
CommentBuilder CommentBuilder
}
func (*DefaultProjectCommandContextBuilder) BuildProjectContext ¶ added in v0.17.0
func (cb *DefaultProjectCommandContextBuilder) BuildProjectContext( ctx *command.Context, cmdName command.Name, subName string, prjCfg valid.MergedProjectCfg, commentFlags []string, repoDir string, automerge, parallelApply, parallelPlan, verbose bool, terraformClient terraform.Client, ) (projectCmds []command.ProjectContext)
type DefaultProjectCommandRunner ¶ added in v0.4.0
type DefaultProjectCommandRunner struct { Locker ProjectLocker LockURLGenerator LockURLGenerator InitStepRunner StepRunner PlanStepRunner StepRunner ShowStepRunner StepRunner ApplyStepRunner StepRunner PolicyCheckStepRunner StepRunner VersionStepRunner StepRunner ImportStepRunner StepRunner StateRmStepRunner StepRunner RunStepRunner CustomStepRunner EnvStepRunner EnvStepRunner MultiEnvStepRunner MultiEnvStepRunner PullApprovedChecker runtime.PullApprovedChecker WorkingDir WorkingDir Webhooks WebhooksSender WorkingDirLocker WorkingDirLocker CommandRequirementHandler CommandRequirementHandler }
DefaultProjectCommandRunner implements ProjectCommandRunner.
func (*DefaultProjectCommandRunner) Apply ¶ added in v0.4.0
func (p *DefaultProjectCommandRunner) Apply(ctx command.ProjectContext) command.ProjectResult
Apply runs terraform apply for the project described by ctx.
func (*DefaultProjectCommandRunner) ApprovePolicies ¶ added in v0.17.0
func (p *DefaultProjectCommandRunner) ApprovePolicies(ctx command.ProjectContext) command.ProjectResult
func (*DefaultProjectCommandRunner) Import ¶ added in v0.22.0
func (p *DefaultProjectCommandRunner) Import(ctx command.ProjectContext) command.ProjectResult
Import runs terraform import for the project described by ctx.
func (*DefaultProjectCommandRunner) Plan ¶ added in v0.4.0
func (p *DefaultProjectCommandRunner) Plan(ctx command.ProjectContext) command.ProjectResult
Plan runs terraform plan for the project described by ctx.
func (*DefaultProjectCommandRunner) PolicyCheck ¶ added in v0.17.0
func (p *DefaultProjectCommandRunner) PolicyCheck(ctx command.ProjectContext) command.ProjectResult
PolicyCheck evaluates policies defined with Rego for the project described by ctx.
func (*DefaultProjectCommandRunner) StateRm ¶ added in v0.23.0
func (p *DefaultProjectCommandRunner) StateRm(ctx command.ProjectContext) command.ProjectResult
StateRm runs terraform state rm for the project described by ctx.
func (*DefaultProjectCommandRunner) Version ¶ added in v0.17.3
func (p *DefaultProjectCommandRunner) Version(ctx command.ProjectContext) command.ProjectResult
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.SimpleLogging, modifiedFiles []string, repoFullName string, absRepoDir string, autoplanFileList string, moduleInfo ModuleProjects) []models.Project
See ProjectFinder.DetermineProjects.
func (*DefaultProjectFinder) DetermineProjectsViaConfig ¶ added in v0.4.0
func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log logging.SimpleLogging, modifiedFiles []string, config valid.RepoCfg, absRepoDir string) ([]valid.Project, error)
See ProjectFinder.DetermineProjectsViaConfig.
func (*DefaultProjectFinder) DetermineWorkspaceFromHCL ¶ added in v0.19.9
func (p *DefaultProjectFinder) DetermineWorkspaceFromHCL(log logging.SimpleLogging, absRepoDir string) (string, error)
type DefaultProjectLocker ¶ added in v0.4.0
type DefaultProjectLocker struct { Locker locking.Locker NoOpLocker locking.Locker VCSClient vcs.Client }
DefaultProjectLocker implements ProjectLocker.
func (*DefaultProjectLocker) TryLock ¶ added in v0.4.0
func (p *DefaultProjectLocker) TryLock(log logging.SimpleLogging, pull models.PullRequest, user models.User, workspace string, project models.Project, repoLocking bool) (*TryLockResponse, error)
TryLock implements ProjectLocker.TryLock.
type DefaultWorkingDirLocker ¶ added in v0.4.0
type DefaultWorkingDirLocker struct {
// contains filtered or unexported fields
}
DefaultWorkingDirLocker implements WorkingDirLocker.
func NewDefaultWorkingDirLocker ¶ added in v0.4.0
func NewDefaultWorkingDirLocker() *DefaultWorkingDirLocker
NewDefaultWorkingDirLocker is a constructor.
func (*DefaultWorkingDirLocker) TryLockPull ¶ added in v0.4.5
func (d *DefaultWorkingDirLocker) TryLockPull(repoFullName string, pullNum int) (func(), error)
func (*DefaultWorkingDirLocker) UnlockPull ¶ added in v0.4.5
func (d *DefaultWorkingDirLocker) UnlockPull(repoFullName string, pullNum int)
Unlock unlocks all workspaces for this pull.
type DeleteLockCommand ¶ added in v0.14.0
type DeleteLockCommand interface { DeleteLock(id string) (*models.ProjectLock, error) DeleteLocksByPull(repoFullName string, pullNum int) (int, error) }
DeleteLockCommand is the first step after a command request has been parsed.
type DirNotExistErr ¶ added in v0.4.14
type DirNotExistErr struct {
RepoRelDir string
}
DirNotExistErr is an error caused by the directory not existing.
func (DirNotExistErr) Error ¶ added in v0.4.14
func (d DirNotExistErr) Error() string
Error implements the error interface.
type DrainStatus ¶ added in v0.13.0
type Drainer ¶ added in v0.13.0
type Drainer struct {
// contains filtered or unexported fields
}
Drainer is used to gracefully shut down atlantis by waiting for in-progress operations to complete.
func (*Drainer) GetStatus ¶ added in v0.13.0
func (d *Drainer) GetStatus() DrainStatus
func (*Drainer) OpDone ¶ added in v0.13.0
func (d *Drainer) OpDone()
OpDone marks an operation as complete.
func (*Drainer) ShutdownBlocking ¶ added in v0.13.0
func (d *Drainer) ShutdownBlocking()
ShutdownBlocking sets "shutting down" to true and blocks until there are no in progress operations.
type EnvStepRunner ¶ added in v0.9.0
type EnvStepRunner interface {
Run(ctx command.ProjectContext, cmd string, value string, path string, envs map[string]string) (string, error)
}
EnvStepRunner runs env steps.
type EventParser ¶
type EventParser struct { GithubUser string GithubToken string GitlabUser string GitlabToken string AllowDraftPRs bool BitbucketUser string BitbucketToken string BitbucketServerURL string AzureDevopsToken string AzureDevopsUser string }
EventParser parses VCS events.
func (*EventParser) GetBitbucketCloudPullEventType ¶ added in v0.4.8
func (e *EventParser) GetBitbucketCloudPullEventType(eventTypeHeader string) models.PullRequestEventType
GetBitbucketCloudPullEventType returns the type of the pull request event given the Bitbucket Cloud header.
func (*EventParser) GetBitbucketServerPullEventType ¶ added in v0.4.8
func (e *EventParser) GetBitbucketServerPullEventType(eventTypeHeader string) models.PullRequestEventType
GetBitbucketServerPullEventType returns the type of the pull request event given the Bitbucket Server header.
func (*EventParser) ParseAPIPlanRequest ¶ added in v0.19.8
func (e *EventParser) ParseAPIPlanRequest(vcsHostType models.VCSHostType, repoFullName string, cloneURL string) (models.Repo, error)
func (*EventParser) ParseAzureDevopsPull ¶ added in v0.10.0
func (e *EventParser) ParseAzureDevopsPull(pull *azuredevops.GitPullRequest) (pullModel models.PullRequest, baseRepo models.Repo, headRepo models.Repo, err error)
ParseAzureDevopsPull parses the response from the Azure DevOps API endpoint (not from a webhook) that returns a pull request. See EventParsing for return value docs.
func (*EventParser) ParseAzureDevopsPullEvent ¶ added in v0.10.0
func (e *EventParser) ParseAzureDevopsPullEvent(event azuredevops.Event) (pull models.PullRequest, pullEventType models.PullRequestEventType, baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseAzureDevopsPullEvent parses Azure DevOps pull request events. See EventParsing for return value docs.
func (*EventParser) ParseAzureDevopsRepo ¶ added in v0.10.0
func (e *EventParser) ParseAzureDevopsRepo(adRepo *azuredevops.GitRepository) (models.Repo, error)
ParseAzureDevopsRepo parses the response from the Azure DevOps API endpoint that returns a repo into the Atlantis model. If the event payload doesn't contain a parent repository reference, extract the owner name from the URL. The URL will match one of two different formats:
https://runatlantis.visualstudio.com/project/_git/repo https://dev.azure.com/runatlantis/project/_git/repo
See EventParsing for return value docs.
func (*EventParser) ParseBitbucketCloudPullCommentEvent ¶ added in v0.4.8
func (e *EventParser) ParseBitbucketCloudPullCommentEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, comment string, err error)
ParseBitbucketCloudPullCommentEvent parses a pull request comment event from Bitbucket Cloud (bitbucket.org). See EventParsing for return value docs.
func (*EventParser) ParseBitbucketCloudPullEvent ¶ added in v0.4.3
func (e *EventParser) ParseBitbucketCloudPullEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseBitbucketCloudPullEvent parses a pull request event from Bitbucket Cloud (bitbucket.org). See EventParsing for return value docs.
func (*EventParser) ParseBitbucketServerPullCommentEvent ¶ added in v0.4.8
func (e *EventParser) ParseBitbucketServerPullCommentEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, comment string, err error)
ParseBitbucketServerPullCommentEvent parses a pull request comment event from Bitbucket Server. See EventParsing for return value docs.
func (*EventParser) ParseBitbucketServerPullEvent ¶ added in v0.4.4
func (e *EventParser) ParseBitbucketServerPullEvent(body []byte) (pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseBitbucketServerPullEvent parses a pull request event from Bitbucket Server. See EventParsing for return value docs.
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)
ParseGithubIssueCommentEvent parses GitHub pull request comment events. See EventParsing for return value docs.
func (*EventParser) ParseGithubPull ¶ added in v0.2.0
func (e *EventParser) ParseGithubPull(pull *github.PullRequest) (pullModel models.PullRequest, baseRepo models.Repo, headRepo models.Repo, err error)
ParseGithubPull parses the response from the GitHub API endpoint (not from a webhook) that returns a pull request. See EventParsing for return value docs.
func (*EventParser) ParseGithubPullEvent ¶ added in v0.4.0
func (e *EventParser) ParseGithubPullEvent(pullEvent *github.PullRequestEvent) (pull models.PullRequest, pullEventType models.PullRequestEventType, baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseGithubPullEvent parses GitHub pull request events. See EventParsing for return value docs.
func (*EventParser) ParseGithubRepo ¶ added in v0.2.0
func (e *EventParser) ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error)
ParseGithubRepo parses the response from the GitHub API endpoint that returns a repo into the Atlantis model. See EventParsing for return value docs.
func (*EventParser) ParseGitlabMergeRequest ¶ added in v0.2.0
func (e *EventParser) ParseGitlabMergeRequest(mr *gitlab.MergeRequest, baseRepo models.Repo) models.PullRequest
ParseGitlabMergeRequest parses the merge requests and returns a pull request model. We require passing in baseRepo because we can't get this information from the merge request. The only caller of this function already has that data so we can construct the pull request object correctly.
func (*EventParser) ParseGitlabMergeRequestCommentEvent ¶ added in v0.4.8
func (e *EventParser) ParseGitlabMergeRequestCommentEvent(event gitlab.MergeCommentEvent) (baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseGitlabMergeRequestCommentEvent parses GitLab merge request comment events. See EventParsing for return value docs.
func (*EventParser) ParseGitlabMergeRequestEvent ¶ added in v0.4.8
func (e *EventParser) ParseGitlabMergeRequestEvent(event gitlab.MergeEvent) (pull models.PullRequest, eventType models.PullRequestEventType, baseRepo models.Repo, headRepo models.Repo, user models.User, err error)
ParseGitlabMergeRequestEvent parses GitLab merge request events. pull is the parsed merge request. See EventParsing for return value docs.
func (*EventParser) ParseGitlabMergeRequestUpdateEvent ¶ added in v0.19.5
func (e *EventParser) ParseGitlabMergeRequestUpdateEvent(event gitlab.MergeEvent) models.PullRequestEventType
ParseGitlabMergeRequestUpdateEvent dives deeper into Gitlab merge request update events
type EventParsing ¶
type EventParsing interface { // ParseGithubIssueCommentEvent parses GitHub pull request comment events. // baseRepo is the repo that the pull request will be merged into. // user is the pull request author. // pullNum is the number of the pull request that triggered the webhook. ParseGithubIssueCommentEvent(comment *github.IssueCommentEvent) ( baseRepo models.Repo, user models.User, pullNum int, err error) // ParseGithubPull parses the response from the GitHub API endpoint (not // from a webhook) that returns a pull request. // pull is the parsed pull request. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. ParseGithubPull(ghPull *github.PullRequest) ( pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, err error) // ParseGithubPullEvent parses GitHub pull request events. // pull is the parsed pull request. // pullEventType is the type of event, for example opened/closed. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. // user is the pull request author. ParseGithubPullEvent(pullEvent *github.PullRequestEvent) ( pull models.PullRequest, pullEventType models.PullRequestEventType, baseRepo models.Repo, headRepo models.Repo, user models.User, err error) // ParseGithubRepo parses the response from the GitHub API endpoint that // returns a repo into the Atlantis model. ParseGithubRepo(ghRepo *github.Repository) (models.Repo, error) // ParseGitlabMergeRequestEvent parses GitLab merge request events. // pull is the parsed merge request. // pullEventType is the type of event, for example opened/closed. // baseRepo is the repo the merge request will be merged into. // headRepo is the repo the merge request branch is from. // user is the pull request author. ParseGitlabMergeRequestEvent(event gitlab.MergeEvent) ( pull models.PullRequest, pullEventType models.PullRequestEventType, baseRepo models.Repo, headRepo models.Repo, user models.User, err error) // ParseGitlabMergeRequestUpdateEvent dives deeper into Gitlab merge request update events to check // if Atlantis should handle events or not. Atlantis should ignore events which dont change the MR content // We assume that 1 event carries multiple events, so firstly need to check for events triggering Atlantis planning // Default 'unknown' event to 'models.UpdatedPullEvent' ParseGitlabMergeRequestUpdateEvent(event gitlab.MergeEvent) models.PullRequestEventType // ParseGitlabMergeRequestCommentEvent parses GitLab merge request comment // events. // baseRepo is the repo the merge request will be merged into. // headRepo is the repo the merge request branch is from. // user is the pull request author. ParseGitlabMergeRequestCommentEvent(event gitlab.MergeCommentEvent) ( baseRepo models.Repo, headRepo models.Repo, user models.User, err error) // ParseGitlabMergeRequest parses the response from the GitLab API endpoint // that returns a merge request. ParseGitlabMergeRequest(mr *gitlab.MergeRequest, baseRepo models.Repo) models.PullRequest ParseAPIPlanRequest(vcsHostType models.VCSHostType, path string, cloneURL string) (baseRepo models.Repo, err error) // ParseBitbucketCloudPullEvent parses a pull request event from Bitbucket // Cloud (bitbucket.org). // pull is the parsed pull request. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. // user is the pull request author. ParseBitbucketCloudPullEvent(body []byte) ( pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, err error) // ParseBitbucketCloudPullCommentEvent parses a pull request comment event // from Bitbucket Cloud (bitbucket.org). // pull is the parsed pull request. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. // user is the pull request author. // comment is the comment that triggered the event. ParseBitbucketCloudPullCommentEvent(body []byte) ( pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, comment string, err error) // GetBitbucketCloudPullEventType returns the type of the pull request // event given the Bitbucket Cloud header. GetBitbucketCloudPullEventType(eventTypeHeader string) models.PullRequestEventType // ParseBitbucketServerPullEvent parses a pull request event from Bitbucket // Server. // pull is the parsed pull request. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. // user is the pull request author. ParseBitbucketServerPullEvent(body []byte) ( pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, err error) // ParseBitbucketServerPullCommentEvent parses a pull request comment event // from Bitbucket Server. // pull is the parsed pull request. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. // user is the pull request author. // comment is the comment that triggered the event. ParseBitbucketServerPullCommentEvent(body []byte) ( pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, user models.User, comment string, err error) // GetBitbucketServerPullEventType returns the type of the pull request // event given the Bitbucket Server header. GetBitbucketServerPullEventType(eventTypeHeader string) models.PullRequestEventType // ParseAzureDevopsPull parses the response from the Azure DevOps API endpoint (not // from a webhook) that returns a pull request. // pull is the parsed pull request. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. ParseAzureDevopsPull(adPull *azuredevops.GitPullRequest) ( pull models.PullRequest, baseRepo models.Repo, headRepo models.Repo, err error) // ParseAzureDevopsPullEvent parses Azure DevOps pull request events. // pull is the parsed pull request. // pullEventType is the type of event, for example opened/closed. // baseRepo is the repo the pull request will be merged into. // headRepo is the repo the pull request branch is from. // user is the pull request author. ParseAzureDevopsPullEvent(pullEvent azuredevops.Event) ( pull models.PullRequest, pullEventType models.PullRequestEventType, baseRepo models.Repo, headRepo models.Repo, user models.User, err error) // ParseAzureDevopsRepo parses the response from the Azure DevOps API endpoint that // returns a repo into the Atlantis model. ParseAzureDevopsRepo(adRepo *azuredevops.GitRepository) (models.Repo, error) }
EventParsing parses webhook events from different VCS hosts into their respective Atlantis models. todo: rename to VCSParsing or the like because this also parses API responses #refactor
type FileWorkspace ¶
type FileWorkspace struct { DataDir string // CheckoutMerge is true if we should check out the branch that corresponds // to what the base branch will look like *after* the pull request is merged. // If this is false, then we will check out the head branch from the pull // request. CheckoutMerge bool // CheckoutDepth is how many commits of feature branch and main branch we'll // retrieve by default. If their merge base is not retrieved with this depth, // full fetch will be performed. Only matters if CheckoutMerge=true. CheckoutDepth int // TestingOverrideHeadCloneURL can be used during testing to override the // URL of the head repo to be cloned. If it's empty then we clone normally. TestingOverrideHeadCloneURL string // TestingOverrideBaseCloneURL can be used during testing to override the // URL of the base repo to be cloned. If it's empty then we clone normally. TestingOverrideBaseCloneURL string // GithubAppEnabled is true if we should fetch the ref "pull/PR_NUMBER/head" // from the "origin" remote. If this is false, we fetch "+refs/heads/$HEAD_BRANCH" // from the "head" remote. GithubAppEnabled bool // use the global setting without overriding GpgNoSigningEnabled bool }
FileWorkspace implements WorkingDir with the file system.
func (*FileWorkspace) Clone ¶
func (w *FileWorkspace) Clone( log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) (string, bool, error)
Clone git clones headRepo, checks out the branch and then returns the absolute path to the root of the cloned repo. It also returns a boolean indicating if we should warn users that the branch we're merging into has been updated since we cloned it. If the repo already exists and is at the right commit it does nothing. This is to support running commands in multiple dirs of the same repo without deleting existing plans.
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) DeleteForWorkspace ¶ added in v0.4.0
func (w *FileWorkspace) DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) error
DeleteForWorkspace deletes the working dir for this workspace.
func (*FileWorkspace) GetPullDir ¶ added in v0.4.5
func (w *FileWorkspace) GetPullDir(r models.Repo, p models.PullRequest) (string, error)
GetPullDir returns the dir where the workspaces for this pull are cloned. If the dir doesn't exist it will return an error.
func (*FileWorkspace) GetWorkingDir ¶ added in v0.4.0
func (w *FileWorkspace) GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) (string, error)
GetWorkingDir returns the path to the workspace for this repo and pull.
func (*FileWorkspace) HasDiverged ¶ added in v0.17.1
func (w *FileWorkspace) HasDiverged(log logging.SimpleLogging, cloneDir string) bool
type GithubAppWorkingDir ¶ added in v0.14.0
type GithubAppWorkingDir struct { WorkingDir Credentials vcs.GithubCredentials GithubHostname string }
GithubAppWorkingDir implements WorkingDir. It acts as a proxy to an instance of WorkingDir that refreshes the app's token before every clone, given Github App tokens expire quickly
func (*GithubAppWorkingDir) Clone ¶ added in v0.14.0
func (g *GithubAppWorkingDir) Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) (string, bool, error)
Clone writes a fresh token for Github App authentication
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 ImportCommandRunner ¶ added in v0.22.0
type ImportCommandRunner struct { SilenceNoProjects bool // contains filtered or unexported fields }
func NewImportCommandRunner ¶ added in v0.22.0
func NewImportCommandRunner( pullUpdater *PullUpdater, pullReqStatusFetcher vcs.PullReqStatusFetcher, prjCmdBuilder ProjectImportCommandBuilder, prjCmdRunner ProjectImportCommandRunner, SilenceNoProjects bool, ) *ImportCommandRunner
func (*ImportCommandRunner) Run ¶ added in v0.22.0
func (v *ImportCommandRunner) Run(ctx *command.Context, cmd *CommentCommand)
type InstrumentedProjectCommandBuilder ¶ added in v0.19.3
type InstrumentedProjectCommandBuilder struct { ProjectCommandBuilder Logger logging.SimpleLogging // contains filtered or unexported fields }
func NewInstrumentedProjectCommandBuilder ¶ added in v0.19.3
func NewInstrumentedProjectCommandBuilder( policyChecksSupported bool, parserValidator *config.ParserValidator, projectFinder ProjectFinder, vcsClient vcs.Client, workingDir WorkingDir, workingDirLocker WorkingDirLocker, globalCfg valid.GlobalCfg, pendingPlanFinder *DefaultPendingPlanFinder, commentBuilder CommentBuilder, skipCloneNoChanges bool, EnableRegExpCmd bool, AutoDetectModuleFiles string, AutoplanFileList string, RestrictFileList bool, SilenceNoProjects bool, scope tally.Scope, logger logging.SimpleLogging, terraformClient terraform.Client, ) *InstrumentedProjectCommandBuilder
func (*InstrumentedProjectCommandBuilder) BuildApplyCommands ¶ added in v0.19.3
func (b *InstrumentedProjectCommandBuilder) BuildApplyCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
func (*InstrumentedProjectCommandBuilder) BuildAutoplanCommands ¶ added in v0.19.3
func (b *InstrumentedProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error)
func (*InstrumentedProjectCommandBuilder) BuildImportCommands ¶ added in v0.23.0
func (b *InstrumentedProjectCommandBuilder) BuildImportCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
func (*InstrumentedProjectCommandBuilder) BuildPlanCommands ¶ added in v0.19.3
func (b *InstrumentedProjectCommandBuilder) BuildPlanCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
func (*InstrumentedProjectCommandBuilder) BuildStateRmCommands ¶ added in v0.23.0
func (b *InstrumentedProjectCommandBuilder) BuildStateRmCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error)
type InstrumentedProjectCommandRunner ¶ added in v0.19.3
type InstrumentedProjectCommandRunner struct {
// contains filtered or unexported fields
}
func NewInstrumentedProjectCommandRunner ¶ added in v0.22.0
func NewInstrumentedProjectCommandRunner(scope tally.Scope, projectCommandRunner ProjectCommandRunner) *InstrumentedProjectCommandRunner
func (*InstrumentedProjectCommandRunner) Apply ¶ added in v0.19.3
func (p *InstrumentedProjectCommandRunner) Apply(ctx command.ProjectContext) command.ProjectResult
func (*InstrumentedProjectCommandRunner) ApprovePolicies ¶ added in v0.22.0
func (p *InstrumentedProjectCommandRunner) ApprovePolicies(ctx command.ProjectContext) command.ProjectResult
func (*InstrumentedProjectCommandRunner) Import ¶ added in v0.22.0
func (p *InstrumentedProjectCommandRunner) Import(ctx command.ProjectContext) command.ProjectResult
func (*InstrumentedProjectCommandRunner) Plan ¶ added in v0.19.3
func (p *InstrumentedProjectCommandRunner) Plan(ctx command.ProjectContext) command.ProjectResult
func (*InstrumentedProjectCommandRunner) PolicyCheck ¶ added in v0.19.3
func (p *InstrumentedProjectCommandRunner) PolicyCheck(ctx command.ProjectContext) command.ProjectResult
func (*InstrumentedProjectCommandRunner) StateRm ¶ added in v0.23.0
func (p *InstrumentedProjectCommandRunner) StateRm(ctx command.ProjectContext) command.ProjectResult
type InstrumentedPullClosedExecutor ¶ added in v0.19.3
type InstrumentedPullClosedExecutor struct {
// contains filtered or unexported fields
}
func (*InstrumentedPullClosedExecutor) CleanUpPull ¶ added in v0.19.3
func (e *InstrumentedPullClosedExecutor) CleanUpPull(repo models.Repo, pull models.PullRequest) error
type IntrumentedCommandRunner ¶ added in v0.22.0
type IntrumentedCommandRunner interface { Plan(ctx command.ProjectContext) command.ProjectResult PolicyCheck(ctx command.ProjectContext) command.ProjectResult Apply(ctx command.ProjectContext) command.ProjectResult ApprovePolicies(ctx command.ProjectContext) command.ProjectResult Import(ctx command.ProjectContext) command.ProjectResult StateRm(ctx command.ProjectContext) command.ProjectResult }
type JobMessageSender ¶ added in v0.18.3
type JobMessageSender interface {
Send(ctx command.ProjectContext, msg string, operationComplete bool)
}
type JobURLSetter ¶ added in v0.18.3
type JobURLSetter interface { // SetJobURLWithStatus sets the commit status for the project represented by // ctx and updates the status with and url to a job. SetJobURLWithStatus(ctx command.ProjectContext, cmdName command.Name, status models.CommitStatus, result *command.ProjectResult) error }
type LockURLGenerator ¶
type LockURLGenerator interface { // GenerateLockURL returns the full URL to the lock at lockID. GenerateLockURL(lockID string) string }
LockURLGenerator generates urls to locks.
type MarkdownRenderer ¶ added in v0.2.0
type MarkdownRenderer struct {
// contains filtered or unexported fields
}
MarkdownRenderer renders responses as markdown.
func NewMarkdownRenderer ¶ added in v0.22.2
func NewMarkdownRenderer( gitlabSupportsCommonMark bool, disableApplyAll bool, disableApply bool, disableMarkdownFolding bool, disableRepoLocking bool, enableDiffMarkdownFormat bool, markdownTemplateOverridesDir string, executableName string, hideUnchangedPlanComments bool, ) *MarkdownRenderer
Initialize templates
type ModuleProjects ¶ added in v0.22.0
type ModuleProjects interface { // DependentProjects returns all projects that depend on the module at moduleDir DependentProjects(moduleDir string) []string }
func FindModuleProjects ¶ added in v0.22.0
func FindModuleProjects(absRepoDir string, autoplanModuleDependants string) (ModuleProjects, error)
FindModuleProjects returns a mapping of modules to projects that depend on them.
type MultiEnvStepRunner ¶ added in v0.19.4
type MultiEnvStepRunner interface { // Run cmd in path. Run(ctx command.ProjectContext, cmd string, path string, envs map[string]string) (string, error) }
MultiEnvStepRunner runs multienv steps.
type PendingPlan ¶ added in v0.4.5
type PendingPlan struct { // RepoDir is the absolute path to the root of the repo that holds this // plan. RepoDir string // RepoRelDir is the relative path from the repo to the project that // the plan is for. RepoRelDir string // Workspace is the workspace this plan should execute in. Workspace string ProjectName string }
PendingPlan is a plan that has not been applied.
type PendingPlanFinder ¶ added in v0.4.5
type PendingPlanFinder interface { Find(pullDir string) ([]PendingPlan, error) DeletePlans(pullDir string) error }
type PlanCommandRunner ¶ added in v0.17.0
type PlanCommandRunner struct { // SilenceNoProjects is whether Atlantis should respond to PRs if no projects // are found SilenceNoProjects bool // DiscardApprovalOnPlan controls if all already existing approvals should be removed/dismissed before executing // a plan. DiscardApprovalOnPlan bool // contains filtered or unexported fields }
func NewPlanCommandRunner ¶ added in v0.17.0
func NewPlanCommandRunner( silenceVCSStatusNoPlans bool, silenceVCSStatusNoProjects bool, vcsClient vcs.Client, pendingPlanFinder PendingPlanFinder, workingDir WorkingDir, commitStatusUpdater CommitStatusUpdater, projectCommandBuilder ProjectPlanCommandBuilder, projectCommandRunner ProjectPlanCommandRunner, dbUpdater *DBUpdater, pullUpdater *PullUpdater, policyCheckCommandRunner *PolicyCheckCommandRunner, autoMerger *AutoMerger, parallelPoolSize int, SilenceNoProjects bool, pullStatusFetcher PullStatusFetcher, lockingLocker locking.Locker, discardApprovalOnPlan bool, pullReqStatusFetcher vcs.PullReqStatusFetcher, ) *PlanCommandRunner
func (*PlanCommandRunner) Run ¶ added in v0.17.0
func (p *PlanCommandRunner) Run(ctx *command.Context, cmd *CommentCommand)
type PolicyCheckCommand ¶ added in v0.17.0
type PolicyCheckCommand struct{}
PolicyCheckCommand is a policy_check command that is automatically triggered after successful plan command.
func (PolicyCheckCommand) CommandName ¶ added in v0.17.0
func (c PolicyCheckCommand) CommandName() command.Name
CommandName is policy_check.
func (PolicyCheckCommand) IsAutoplan ¶ added in v0.17.0
func (c PolicyCheckCommand) IsAutoplan() bool
IsAutoplan is true for policy_check commands.
func (PolicyCheckCommand) IsVerbose ¶ added in v0.17.0
func (c PolicyCheckCommand) IsVerbose() bool
IsVerbose is false for policy_check commands.
func (PolicyCheckCommand) SubCommandName ¶ added in v0.23.0
func (c PolicyCheckCommand) SubCommandName() string
SubCommandName is a subcommand for policy_check.
type PolicyCheckCommandRunner ¶ added in v0.17.0
type PolicyCheckCommandRunner struct {
// contains filtered or unexported fields
}
func NewPolicyCheckCommandRunner ¶ added in v0.17.0
func NewPolicyCheckCommandRunner( dbUpdater *DBUpdater, pullUpdater *PullUpdater, commitStatusUpdater CommitStatusUpdater, projectCommandRunner ProjectPolicyCheckCommandRunner, parallelPoolSize int, silenceVCSStatusNoProjects bool, quietPolicyChecks bool, ) *PolicyCheckCommandRunner
func (*PolicyCheckCommandRunner) Run ¶ added in v0.17.0
func (p *PolicyCheckCommandRunner) Run(ctx *command.Context, cmds []command.ProjectContext)
type PolicyCheckProjectCommandContextBuilder ¶ added in v0.17.0
type PolicyCheckProjectCommandContextBuilder struct { ProjectCommandContextBuilder *DefaultProjectCommandContextBuilder CommentBuilder CommentBuilder }
func (*PolicyCheckProjectCommandContextBuilder) BuildProjectContext ¶ added in v0.17.0
func (cb *PolicyCheckProjectCommandContextBuilder) BuildProjectContext( ctx *command.Context, cmdName command.Name, subCmdName string, prjCfg valid.MergedProjectCfg, commentFlags []string, repoDir string, automerge, parallelApply, parallelPlan, verbose bool, terraformClient terraform.Client, ) (projectCmds []command.ProjectContext)
type PostWorkflowHookURLGenerator ¶ added in v0.22.0
type PostWorkflowHookURLGenerator interface {
GenerateProjectWorkflowHookURL(hookID string) (string, error)
}
PostWorkflowHookURLGenerator generates urls to view the post workflow progress.
type PostWorkflowHooksCommandRunner ¶ added in v0.18.2
type PostWorkflowHooksCommandRunner interface {
RunPostHooks(ctx *command.Context, cmd *CommentCommand) error
}
type PreWorkflowHookURLGenerator ¶ added in v0.22.0
type PreWorkflowHookURLGenerator interface {
GenerateProjectWorkflowHookURL(hookID string) (string, error)
}
PreWorkflowHookURLGenerator generates urls to view the pre workflow progress.
type PreWorkflowHooksCommandRunner ¶ added in v0.16.0
type PreWorkflowHooksCommandRunner interface {
RunPreHooks(ctx *command.Context, cmd *CommentCommand) error
}
type ProjectApplyCommandBuilder ¶ added in v0.17.0
type ProjectApplyCommandBuilder interface { // BuildApplyCommands builds project Apply commands for this ctx and comment. If // comment doesn't specify one project then there may be multiple commands // to be run. BuildApplyCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) }
type ProjectApplyCommandRunner ¶ added in v0.17.0
type ProjectApplyCommandRunner interface { // Apply runs terraform apply for the project described by ctx. Apply(ctx command.ProjectContext) command.ProjectResult }
type ProjectApprovePoliciesCommandBuilder ¶ added in v0.17.0
type ProjectApprovePoliciesCommandBuilder interface { // BuildApprovePoliciesCommands builds project PolicyCheck commands for this ctx and comment. BuildApprovePoliciesCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) }
type ProjectApprovePoliciesCommandRunner ¶ added in v0.17.0
type ProjectApprovePoliciesCommandRunner interface { // Approves any failing OPA policies. ApprovePolicies(ctx command.ProjectContext) command.ProjectResult }
type ProjectCommandBuilder ¶ added in v0.4.0
type ProjectCommandBuilder interface { ProjectPlanCommandBuilder ProjectApplyCommandBuilder ProjectApprovePoliciesCommandBuilder ProjectVersionCommandBuilder ProjectImportCommandBuilder ProjectStateCommandBuilder }
ProjectCommandBuilder builds commands that run on individual projects.
type ProjectCommandContextBuilder ¶ added in v0.17.0
type ProjectCommandContextBuilder interface { // BuildProjectContext builds project command contexts for atlantis commands BuildProjectContext( ctx *command.Context, cmdName command.Name, subCmdName string, prjCfg valid.MergedProjectCfg, commentFlags []string, repoDir string, automerge, parallelApply, parallelPlan, verbose bool, terraformClient terraform.Client, ) []command.ProjectContext }
func NewProjectCommandContextBuilder ¶ added in v0.18.3
func NewProjectCommandContextBuilder(policyCheckEnabled bool, commentBuilder CommentBuilder, scope tally.Scope) ProjectCommandContextBuilder
type ProjectCommandRunner ¶ added in v0.4.0
type ProjectCommandRunner interface { ProjectPlanCommandRunner ProjectApplyCommandRunner ProjectPolicyCheckCommandRunner ProjectApprovePoliciesCommandRunner ProjectVersionCommandRunner ProjectImportCommandRunner ProjectStateCommandRunner }
ProjectCommandRunner runs project commands. A project command is a command for a specific TF project.
type ProjectFinder ¶
type ProjectFinder interface { // DetermineProjects returns the list of projects that were modified based on // the modifiedFiles. The list will be de-duplicated. // absRepoDir is the path to the cloned repo on disk. DetermineProjects(log logging.SimpleLogging, modifiedFiles []string, repoFullName string, absRepoDir string, autoplanFileList string, moduleInfo ModuleProjects) []models.Project // DetermineProjectsViaConfig returns the list of projects that were modified // based on modifiedFiles and the repo's config. // absRepoDir is the path to the cloned repo on disk. DetermineProjectsViaConfig(log logging.SimpleLogging, modifiedFiles []string, config valid.RepoCfg, absRepoDir string) ([]valid.Project, error) DetermineWorkspaceFromHCL(log logging.SimpleLogging, absRepoDir string) (string, error) }
ProjectFinder determines which projects were modified in a given pull request.
type ProjectImportCommandBuilder ¶ added in v0.22.0
type ProjectImportCommandBuilder interface { // BuildImportCommands builds project Import commands for this ctx and comment. If // comment doesn't specify one project then there may be multiple commands // to be run. BuildImportCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) }
type ProjectImportCommandRunner ¶ added in v0.22.0
type ProjectImportCommandRunner interface { // Import runs terraform import for the project described by ctx. Import(ctx command.ProjectContext) command.ProjectResult }
type ProjectLocker ¶ added in v0.4.0
type ProjectLocker interface { // TryLock attempts to acquire the lock for this project. It returns true if the lock // was acquired. If it returns false, the lock was not acquired and the second // return value will be a string describing why the lock was not acquired. // The third return value is a function that can be called to unlock the // lock. It will only be set if the lock was acquired. Any errors will set // error. TryLock(log logging.SimpleLogging, pull models.PullRequest, user models.User, workspace string, project models.Project, repoLocking bool) (*TryLockResponse, error) }
ProjectLocker locks this project against other plans being run until this project is unlocked.
type ProjectOutputWrapper ¶ added in v0.18.0
type ProjectOutputWrapper struct { ProjectCommandRunner JobMessageSender JobMessageSender JobURLSetter JobURLSetter }
ProjectOutputWrapper is a decorator that creates a new PR status check per project. The status contains a url that outputs current progress of the terraform plan/apply command.
func (*ProjectOutputWrapper) Apply ¶ added in v0.18.0
func (p *ProjectOutputWrapper) Apply(ctx command.ProjectContext) command.ProjectResult
func (*ProjectOutputWrapper) Plan ¶ added in v0.18.0
func (p *ProjectOutputWrapper) Plan(ctx command.ProjectContext) command.ProjectResult
type ProjectPlanCommandBuilder ¶ added in v0.17.0
type ProjectPlanCommandBuilder interface { // BuildAutoplanCommands builds project commands that will run plan on // the projects determined to be modified. BuildAutoplanCommands(ctx *command.Context) ([]command.ProjectContext, error) // BuildPlanCommands builds project plan commands for this ctx and comment. If // comment doesn't specify one project then there may be multiple commands // to be run. BuildPlanCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) }
type ProjectPlanCommandRunner ¶ added in v0.17.0
type ProjectPlanCommandRunner interface { // Plan runs terraform plan for the project described by ctx. Plan(ctx command.ProjectContext) command.ProjectResult }
type ProjectPolicyCheckCommandRunner ¶ added in v0.17.0
type ProjectPolicyCheckCommandRunner interface { // PolicyCheck runs OPA defined policies for the project desribed by ctx. PolicyCheck(ctx command.ProjectContext) command.ProjectResult }
type ProjectStateCommandBuilder ¶ added in v0.23.0
type ProjectStateCommandBuilder interface { // BuildStateRmCommands builds project state rm commands for this ctx and comment. If // comment doesn't specify one project then there may be multiple commands // to be run. BuildStateRmCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) }
type ProjectStateCommandRunner ¶ added in v0.23.0
type ProjectStateCommandRunner interface { // StateRm runs terraform state rm for the project described by ctx. StateRm(ctx command.ProjectContext) command.ProjectResult }
type ProjectVersionCommandBuilder ¶ added in v0.17.3
type ProjectVersionCommandBuilder interface { // BuildVersionCommands builds project Version commands for this ctx and comment. If // comment doesn't specify one project then there may be multiple commands // to be run. BuildVersionCommands(ctx *command.Context, comment *CommentCommand) ([]command.ProjectContext, error) }
type ProjectVersionCommandRunner ¶ added in v0.17.3
type ProjectVersionCommandRunner interface { // Version runs terraform version for the project described by ctx. Version(ctx command.ProjectContext) command.ProjectResult }
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.
func NewInstrumentedPullClosedExecutor ¶ added in v0.19.3
func NewInstrumentedPullClosedExecutor( scope tally.Scope, log logging.SimpleLogging, cleaner PullCleaner, ) PullCleaner
type PullCleanupTemplate ¶ added in v0.18.0
type PullClosedEventTemplate ¶ added in v0.18.0
type PullClosedEventTemplate struct{}
type PullClosedExecutor ¶
type PullClosedExecutor struct { Locker locking.Locker VCSClient vcs.Client WorkingDir WorkingDir Logger logging.SimpleLogging Backend locking.Backend PullClosedTemplate PullCleanupTemplate LogStreamResourceCleaner ResourceCleaner }
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 PullCommand ¶ added in v0.4.8
type PullCommand interface { // CommandName is the name of the command we're running. CommandName() command.Name // SubCommandName is the subcommand name of the command we're running. SubCommandName() string // IsVerbose is true if the output of this command should be verbose. IsVerbose() bool // IsAutoplan is true if this is an autoplan command vs. a comment command. IsAutoplan() bool }
PullCommand is a command to run on a pull request.
type PullStatusFetcher ¶ added in v0.17.0
type PullStatusFetcher interface {
GetPullStatus(pull models.PullRequest) (*models.PullStatus, error)
}
PullStatusFetcher fetches our internal model of a pull requests status
type PullUpdater ¶ added in v0.17.0
type PullUpdater struct { HidePrevPlanComments bool VCSClient vcs.Client MarkdownRenderer *MarkdownRenderer }
type RepoAllowlistChecker ¶ added in v0.15.0
type RepoAllowlistChecker struct {
// contains filtered or unexported fields
}
RepoAllowlistChecker implements checking if repos are allowlisted to be used with this Atlantis.
func NewRepoAllowlistChecker ¶ added in v0.15.0
func NewRepoAllowlistChecker(allowlist string) (*RepoAllowlistChecker, error)
NewRepoAllowlistChecker constructs a new checker and validates that the allowlist isn't malformed.
func (*RepoAllowlistChecker) IsAllowlisted ¶ added in v0.15.0
func (r *RepoAllowlistChecker) IsAllowlisted(repoFullName string, vcsHostname string) bool
IsAllowlisted returns true if this repo is in our allowlist and false otherwise.
type ResourceCleaner ¶ added in v0.18.3
type StateCommandRunner ¶ added in v0.23.0
type StateCommandRunner struct {
// contains filtered or unexported fields
}
func NewStateCommandRunner ¶ added in v0.23.0
func NewStateCommandRunner( pullUpdater *PullUpdater, prjCmdBuilder ProjectStateCommandBuilder, prjCmdRunner ProjectStateCommandRunner, ) *StateCommandRunner
func (*StateCommandRunner) Run ¶ added in v0.23.0
func (v *StateCommandRunner) Run(ctx *command.Context, cmd *CommentCommand)
type StepRunner ¶ added in v0.4.0
type StepRunner interface { // Run runs the step. Run(ctx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) }
StepRunner runs steps. Steps are individual pieces of execution like `terraform plan`.
type TeamAllowlistChecker ¶ added in v0.18.0
type TeamAllowlistChecker struct {
// contains filtered or unexported fields
}
TeamAllowlistChecker implements checking the teams and the operations that the members of a particular team are allowed to perform
func NewTeamAllowlistChecker ¶ added in v0.18.0
func NewTeamAllowlistChecker(allowlist string) (*TeamAllowlistChecker, error)
NewTeamAllowlistChecker constructs a new checker
func (*TeamAllowlistChecker) HasRules ¶ added in v0.18.1
func (checker *TeamAllowlistChecker) HasRules() bool
func (*TeamAllowlistChecker) IsCommandAllowedForAnyTeam ¶ added in v0.18.0
func (checker *TeamAllowlistChecker) IsCommandAllowedForAnyTeam(teams []string, command string) bool
IsCommandAllowedForAnyTeam returns true if any of the teams is allowed to execute the command and false otherwise.
func (*TeamAllowlistChecker) IsCommandAllowedForTeam ¶ added in v0.18.0
func (checker *TeamAllowlistChecker) IsCommandAllowedForTeam(team string, command string) bool
IsCommandAllowedForTeam returns true if the team is allowed to execute the command and false otherwise.
type TryLockResponse ¶ added in v0.4.0
type TryLockResponse struct { // LockAcquired is true if the lock was acquired. LockAcquired bool // LockFailureReason is the reason why the lock was not acquired. It will // only be set if LockAcquired is false. LockFailureReason string // UnlockFn will unlock the lock created by the caller. This might be called // if there is an error later and the caller doesn't want to continue to // hold the lock. UnlockFn func() error // LockKey is the key for the lock if the lock was acquired. LockKey string }
TryLockResponse is the result of trying to lock a project.
type UnlockCommandRunner ¶ added in v0.17.0
type UnlockCommandRunner struct { // SilenceNoProjects is whether Atlantis should respond to PRs if no projects // are found SilenceNoProjects bool // contains filtered or unexported fields }
func NewUnlockCommandRunner ¶ added in v0.17.0
func NewUnlockCommandRunner( deleteLockCommand DeleteLockCommand, vcsClient vcs.Client, SilenceNoProjects bool, ) *UnlockCommandRunner
func (*UnlockCommandRunner) Run ¶ added in v0.17.0
func (u *UnlockCommandRunner) Run( ctx *command.Context, cmd *CommentCommand, )
type VarFileAllowlistChecker ¶ added in v0.19.5
type VarFileAllowlistChecker struct {
// contains filtered or unexported fields
}
VarFileAllowlistChecker implements checking if paths are allowlisted to be used with this Atlantis.
func NewVarFileAllowlistChecker ¶ added in v0.19.5
func NewVarFileAllowlistChecker(allowlist string) (*VarFileAllowlistChecker, error)
NewVarFileAllowlistChecker constructs a new checker and validates that the allowlist isn't malformed.
func (*VarFileAllowlistChecker) Check ¶ added in v0.19.5
func (p *VarFileAllowlistChecker) Check(flags []string) error
type VersionCommandRunner ¶ added in v0.17.3
type VersionCommandRunner struct {
// contains filtered or unexported fields
}
func NewVersionCommandRunner ¶ added in v0.17.3
func NewVersionCommandRunner( pullUpdater *PullUpdater, prjCmdBuilder ProjectVersionCommandBuilder, prjCmdRunner ProjectVersionCommandRunner, parallelPoolSize int, silenceVCSStatusNoProjects bool, ) *VersionCommandRunner
func (*VersionCommandRunner) Run ¶ added in v0.17.3
func (v *VersionCommandRunner) Run(ctx *command.Context, cmd *CommentCommand)
type WebhooksSender ¶ added in v0.4.0
type WebhooksSender interface { // Send sends the webhook. Send(log logging.SimpleLogging, res webhooks.ApplyResult) error }
WebhooksSender sends webhook.
type WorkingDir ¶ added in v0.4.0
type WorkingDir interface { // Clone git clones headRepo, checks out the branch and then returns the // absolute path to the root of the cloned repo. It also returns // a boolean indicating if we should warn users that the branch we're // merging into has been updated since we cloned it. Clone(log logging.SimpleLogging, headRepo models.Repo, p models.PullRequest, workspace string) (string, bool, error) // GetWorkingDir returns the path to the workspace for this repo and pull. // If workspace does not exist on disk, error will be of type os.IsNotExist. GetWorkingDir(r models.Repo, p models.PullRequest, workspace string) (string, error) HasDiverged(log logging.SimpleLogging, cloneDir string) bool GetPullDir(r models.Repo, p models.PullRequest) (string, error) // Delete deletes the workspace for this repo and pull. Delete(r models.Repo, p models.PullRequest) error DeleteForWorkspace(r models.Repo, p models.PullRequest, workspace string) error }
WorkingDir handles the workspace on disk for running commands.
type WorkingDirLocker ¶ added in v0.4.0
type WorkingDirLocker interface { // TryLock tries to acquire a lock for this repo, pull, workspace, and path. // It returns a function that should be used to unlock the workspace and // an error if the workspace is already locked. The error is expected to // be printed to the pull request. TryLock(repoFullName string, pullNum int, workspace string, path string) (func(), error) // TryLockPull tries to acquire a lock for all the workspaces in this repo // and pull. // It returns a function that should be used to unlock the workspace and // an error if the workspace is already locked. The error is expected to // be printed to the pull request. TryLockPull(repoFullName string, pullNum int) (func(), error) }
WorkingDirLocker 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.
Source Files ¶
- apply_command_runner.go
- approve_policies_command_runner.go
- automerger.go
- command_requirement_handler.go
- command_runner.go
- command_type.go
- comment_parser.go
- commit_status_updater.go
- db_updater.go
- delete_lock_command.go
- drainer.go
- event_parser.go
- git_cred_writer.go
- github_app_working_dir.go
- import_command_runner.go
- instrumented_project_command_builder.go
- instrumented_project_command_runner.go
- instrumented_pull_closed_executor.go
- markdown_renderer.go
- modules.go
- pending_plan_finder.go
- plan_command_runner.go
- policy_check_command_runner.go
- post_workflow_hooks_command_runner.go
- pre_workflow_hooks_command_runner.go
- project_command_builder.go
- project_command_context_builder.go
- project_command_pool_executor.go
- project_command_runner.go
- project_finder.go
- project_locker.go
- pull_closed_executor.go
- pull_status_fetcher.go
- pull_updater.go
- repo_allowlist_checker.go
- state_command_runner.go
- team_allowlist_checker.go
- unlock_command_runner.go
- var_file_allowlist_checker.go
- version_command_runner.go
- working_dir.go
- working_dir_locker.go
Directories ¶
Path | Synopsis |
---|---|
Code generated by pegomock.
|
Code generated by pegomock. |
matchers
Code generated by pegomock.
|
Code generated by pegomock. |
terraform
|
|
bitbucketcloud
Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org).
|
Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org). |
common
Package common is used to share common code between all VCS clients without running into circular dependency issues.
|
Package common is used to share common code between all VCS clients without running into circular dependency issues. |
mocks/matchers
Code generated by pegomock.
|
Code generated by pegomock. |
mocks/matchers
Code generated by pegomock.
|
Code generated by pegomock. |