Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { // 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://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges HeadRepo models.Repo Pull models.PullRequest Scope tally.Scope // User is the user that triggered this command. User models.User Log logging.SimpleLogging // Current PR state PullRequestStatus models.PullReqStatus PullStatus *models.PullStatus Trigger Trigger }
Context represents the context of a command that should be executed for a pull request.
type Lock ¶
type Lock struct { // Time is the time at which the lock was first created. LockMetadata LockMetadata CommandName Name }
Lock represents a global lock for an atlantis command (plan, apply, policy_check). It is used to prevent commands from being executed
type LockMetadata ¶
type LockMetadata struct {
UnixTime int64
}
LockMetadata contains additional data provided to the lock
type Name ¶
type Name int
Name is which command to run.
const ( // Apply is a command to run terraform apply. Apply Name = iota // Plan is a command to run terraform plan. Plan // Unlock is a command to discard previous plans as well as the atlantis locks. Unlock // PolicyCheck is a command to run conftest test. PolicyCheck // ApprovePolicies is a command to approve policies with owner check ApprovePolicies // Autoplan is a command to run terrafor plan on PR open/update if autoplan is enabled Autoplan // Version is a command to run terraform version. Version )
func (Name) TitleString ¶
TitleString returns the string representation in title form. ie. policy_check becomes Policy Check
type ProjectContext ¶
type ProjectContext struct { CommandName Name // ApplyCmd is the command that users should run to apply this plan. If // this is an apply then this will be empty. ApplyCmd string // ApplyRequirements is the list of requirements that must be satisfied // before we will run the apply stage. ApplyRequirements []string // AutomergeEnabled is true if automerge is enabled for the repo that this // project is in. AutomergeEnabled bool // ParallelApplyEnabled is true if parallel apply is enabled for this project. ParallelApplyEnabled bool // ParallelPlanEnabled is true if parallel plan is enabled for this project. ParallelPlanEnabled bool // ParallelPolicyCheckEnabled is true if parallel policy_check is enabled for this project. ParallelPolicyCheckEnabled bool // AutoplanEnabled is true if autoplanning is enabled for this project. AutoplanEnabled bool // BaseRepo is the repository that the pull request will be merged into. BaseRepo models.Repo // EscapedCommentArgs are the extra arguments that were added to the atlantis // command, ex. atlantis plan -- -target=resource. We then escape them // by adding a \ before each character so that they can be used within // sh -c safely, i.e. sh -c "terraform plan $(touch bad)". EscapedCommentArgs []string // 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. HeadRepo models.Repo // Log is a logger that's been set up for this context. Log logging.SimpleLogging // Scope is the scope for reporting stats setup for this context Scope tally.Scope // PullReqStatus holds state about the PR that requires additional computation outside models.PullRequest PullReqStatus models.PullReqStatus // CurrentProjectPlanStatus is the status of the current project prior to this command. ProjectPlanStatus models.ProjectPlanStatus // Pull is the pull request we're responding to. Pull models.PullRequest // ProjectName is the name of the project set in atlantis.yaml. If there was // no name this will be an empty string. ProjectName string // RepoConfigVersion is the version of the repo's atlantis.yaml file. If // there was no file, this will be 0. RepoConfigVersion int // RePlanCmd is the command that users should run to re-plan this project. // If this is an apply then this will be empty. RePlanCmd string // RepoRelDir is the directory of this project relative to the repo root. RepoRelDir string // Steps are the sequence of commands we need to run for this project and this // stage. Steps []valid.Step // TerraformVersion is the version of terraform we should use when executing // commands for this project. This can be set to nil in which case we will // use the default Atlantis terraform version. TerraformVersion *version.Version // Configuration metadata for a given project. User models.User // Verbose is true when the user would like verbose output. Verbose bool // Workspace is the Terraform workspace this project is in. It will always // be set. Workspace string // PolicySets represent the policies that are run on the plan as part of the // policy check stage PolicySets valid.PolicySets // DeleteSourceBranchOnMerge will attempt to allow a branch to be deleted when merged (AzureDevOps & GitLab Support Only) DeleteSourceBranchOnMerge bool // RepoLocking will get a lock when plan RepoLocking bool // UUID for atlantis logs JobID string // The index of order group. Before planning/applying it will use to sort projects. Default is 0. ExecutionOrderGroup int }
ProjectContext defines the context for a plan or apply stage that will be executed for a project.
func (ProjectContext) GetShowResultFileName ¶
func (p ProjectContext) GetShowResultFileName() string
GetShowResultFileName returns the filename (not the path) to store the tf show result
func (ProjectContext) PullInfo ¶
func (p ProjectContext) PullInfo() string
Gets a unique identifier for the current pull request as a single string
func (ProjectContext) SetScopeTags ¶ added in v0.21.0
func (p ProjectContext) SetScopeTags(scope tally.Scope) tally.Scope
SetScopeTags adds ProjectContext tags to a new returned scope.
type ProjectResult ¶
type ProjectResult struct { Command Name RepoRelDir string Workspace string Error error Failure string PlanSuccess *models.PlanSuccess PolicyCheckSuccess *models.PolicyCheckSuccess ApplySuccess string VersionSuccess string ProjectName string }
ProjectResult is the result of executing a plan/policy_check/apply for a specific project.
func (ProjectResult) CommitStatus ¶
func (p ProjectResult) CommitStatus() models.CommitStatus
CommitStatus returns the vcs commit status of this project result.
func (ProjectResult) IsSuccessful ¶
func (p ProjectResult) IsSuccessful() bool
IsSuccessful returns true if this project result had no errors.
func (ProjectResult) PlanStatus ¶
func (p ProjectResult) PlanStatus() models.ProjectPlanStatus
PlanStatus returns the plan status.
type Result ¶
type Result struct { Error error Failure string ProjectResults []ProjectResult // PlansDeleted is true if all plans created during this command were // deleted. This happens if automerging is enabled and one project has an // error since automerging requires all plans to succeed. PlansDeleted bool }
Result is the result of running a Command.