Documentation
¶
Overview ¶
Package valid contains the structs representing the atlantis.yaml config after it's been parsed and validated.
Package valid contains definitions of valid yaml configuration after its been parsed and validated.
Index ¶
- Constants
- Variables
- type Autoplan
- type GlobalCfg
- func (g GlobalCfg) DefaultProjCfg(log logging.SimpleLogging, repoID string, repoRelDir string, workspace string) MergedProjectCfg
- func (g GlobalCfg) MatchingRepo(repoID string) *Repo
- func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, proj Project, rCfg RepoCfg) MergedProjectCfg
- func (g GlobalCfg) ValidateRepoCfg(rCfg RepoCfg, repoID string) error
- type GlobalCfgArgs
- type MergedProjectCfg
- type PolicyOwners
- type PolicySet
- type PolicySets
- type Project
- type Repo
- type RepoCfg
- func (r RepoCfg) FindProjectByName(name string) *Project
- func (r RepoCfg) FindProjectsByDir(dir string) []Project
- func (r RepoCfg) FindProjectsByDirWorkspace(repoRelDir string, workspace string) []Project
- func (r RepoCfg) FindProjectsByName(name string) []Project
- func (r RepoCfg) ValidateWorkspaceAllowed(repoRelDir string, workspace string) error
- type Stage
- type Step
- type Workflow
- type WorkflowHook
Constants ¶
const ( LocalPolicySet string = "local" GithubPolicySet string = "github" )
const AllowCustomWorkflowsKey = "allow_custom_workflows"
const AllowedOverridesKey = "allowed_overrides"
const AllowedWorkflowsKey = "allowed_workflows"
const ApplyRequirementsKey = "apply_requirements"
const ApprovedApplyReq = "approved"
const DefaultAutoPlanEnabled = true
const DefaultWorkflowName = "default"
const DeleteSourceBranchOnMergeKey = "delete_source_branch_on_merge"
const MergeableApplyReq = "mergeable"
const PoliciesPassedApplyReq = "policies_passed"
const PostWorkflowHooksKey = "post_workflow_hooks"
const PreWorkflowHooksKey = "pre_workflow_hooks"
const UnDivergedApplyReq = "undiverged"
const WorkflowKey = "workflow"
Variables ¶
var DefaultApplyStage = Stage{ Steps: []Step{ { StepName: "apply", }, }, }
DefaultApplyStage is the Atlantis default apply stage.
var DefaultPlanStage = Stage{ Steps: []Step{ { StepName: "init", }, { StepName: "plan", }, }, }
DefaultPlanStage is the Atlantis default plan stage.
var DefaultPolicyCheckStage = Stage{ Steps: []Step{ { StepName: "show", }, { StepName: "policy_check", }, }, }
DefaultPolicyCheckStage is the Atlantis default policy check stage.
var NonOverrideableApplyReqs = []string{PoliciesPassedApplyReq}
NonOverrideableApplyReqs will get applied across all "repos" in the server side config. If repo config is allowed overrides, they can override this. TODO: Make this more customizable, not everyone wants this rigid workflow maybe something along the lines of defining overridable/non-overrideable apply requirements in the config and removing the flag to enable policy checking.
Functions ¶
This section is empty.
Types ¶
type GlobalCfg ¶ added in v0.7.0
type GlobalCfg struct {
Repos []Repo
Workflows map[string]Workflow
PolicySets PolicySets
}
GlobalCfg is the final parsed version of server-side repo config.
func NewGlobalCfg ¶ added in v0.7.0
NewGlobalCfg returns a global config that respects the parameters. allowRepoCfg is true if users want to allow repos full config functionality. mergeableReq is true if users want to set the mergeable apply requirement for all repos. approvedReq is true if users want to set the approved apply requirement for all repos. Deprecated: use NewGlobalCfgFromArgs
func NewGlobalCfgFromArgs ¶ added in v0.17.0
func NewGlobalCfgFromArgs(args GlobalCfgArgs) GlobalCfg
func NewGlobalCfgWithHooks
deprecated
added in
v0.17.0
func NewGlobalCfgWithHooks(allowRepoCfg bool, mergeableReq bool, approvedReq bool, unDivergedReq bool, preWorkflowHooks []*WorkflowHook, postWorkflowHooks []*WorkflowHook) GlobalCfg
Deprecated: use NewGlobalCfgFromArgs
func (GlobalCfg) DefaultProjCfg ¶ added in v0.7.0
func (g GlobalCfg) DefaultProjCfg(log logging.SimpleLogging, repoID string, repoRelDir string, workspace string) MergedProjectCfg
DefaultProjCfg returns the default project config for all projects under the repo with id repoID. It is used when there is no repo config.
func (GlobalCfg) MatchingRepo ¶ added in v0.17.3
MatchingRepo returns an instance of Repo which matches a given repoID. If multiple repos match, return the last one for consistency with getMatchingCfg.
func (GlobalCfg) MergeProjectCfg ¶ added in v0.7.0
func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, proj Project, rCfg RepoCfg) MergedProjectCfg
MergeProjectCfg merges proj and rCfg with the global config to return a final config. It assumes that all configs have been validated.
type GlobalCfgArgs ¶ added in v0.17.0
type GlobalCfgArgs struct {
AllowRepoCfg bool
MergeableReq bool
ApprovedReq bool
UnDivergedReq bool
PolicyCheckEnabled bool
PreWorkflowHooks []*WorkflowHook
PostWorkflowHooks []*WorkflowHook
}
type MergedProjectCfg ¶ added in v0.7.0
type MergedProjectCfg struct {
ApplyRequirements []string
Workflow Workflow
AllowedWorkflows []string
RepoRelDir string
Workspace string
Name string
AutoplanEnabled bool
AutoMergeDisabled bool
TerraformVersion *version.Version
RepoCfgVersion int
PolicySets PolicySets
DeleteSourceBranchOnMerge bool
}
type PolicyOwners ¶ added in v0.17.0
type PolicyOwners struct {
Users []string
}
type PolicySet ¶ added in v0.17.0
type PolicySet struct {
Source string
Path string
Name string
Owners PolicyOwners
}
type PolicySets ¶ added in v0.17.0
type PolicySets struct {
Version *version.Version
Owners PolicyOwners
PolicySets []PolicySet
}
PolicySets defines version of policy checker binary(conftest) and a list of PolicySet objects. PolicySets struct is used by PolicyCheck workflow to build context to enforce policies.
func (*PolicySets) HasPolicies ¶ added in v0.17.0
func (p *PolicySets) HasPolicies() bool
func (*PolicySets) IsOwner ¶ added in v0.17.0
func (p *PolicySets) IsOwner(username string) bool
type Project ¶
type Repo ¶ added in v0.7.0
type Repo struct {
// ID is the exact match id of this config.
// If IDRegex is set then this will be empty.
ID string
// IDRegex is the regex match for this config.
// If ID is set then this will be nil.
IDRegex *regexp.Regexp
BranchRegex *regexp.Regexp
ApplyRequirements []string
PreWorkflowHooks []*WorkflowHook
Workflow *Workflow
PostWorkflowHooks []*WorkflowHook
AllowedWorkflows []string
AllowedOverrides []string
AllowCustomWorkflows *bool
DeleteSourceBranchOnMerge *bool
}
Repo is the final parsed version of server-side repo config.
func (Repo) BranchMatches ¶ added in v0.17.0
BranchMatches returns true if the branch other matches a branch regex (if preset).
type RepoCfg ¶ added in v0.7.0
type RepoCfg struct {
// Version is the version of the atlantis YAML file.
Version int
Projects []Project
Workflows map[string]Workflow
PolicySets PolicySets
Automerge bool
ParallelApply bool
ParallelPlan bool
ParallelPolicyCheck bool
DeleteSourceBranchOnMerge *bool
AllowedRegexpPrefixes []string
}
RepoCfg is the atlantis.yaml config after it's been parsed and validated.
func (RepoCfg) FindProjectByName ¶ added in v0.7.0
func (RepoCfg) FindProjectsByDir ¶ added in v0.7.0
FindProjectsByDir returns all projects that are in dir.
func (RepoCfg) FindProjectsByDirWorkspace ¶ added in v0.7.0
func (RepoCfg) FindProjectsByName ¶ added in v0.17.0
FindProjectsByName returns all projects that match with name.
func (RepoCfg) ValidateWorkspaceAllowed ¶ added in v0.17.0
validateWorkspaceAllowed returns an error if repoCfg defines projects in repoRelDir but none of them use workspace. We want this to be an error because if users have gone to the trouble of defining projects in repoRelDir then it's likely that if we're running a command for a workspace that isn't defined then they probably just typed the workspace name wrong.
type Step ¶
type Step struct {
StepName string
ExtraArgs []string
// RunCommand is either a custom run step or the command to run
// during an env step to populate the environment variable dynamically.
RunCommand string
// EnvVarName is the name of the
// environment variable that should be set by this step.
EnvVarName string
// EnvVarValue is the value to set EnvVarName to.
EnvVarValue string
}
type WorkflowHook ¶ added in v0.18.2
WorkflowHook is a map of custom run commands to run before or after workflows.