Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix typo pt2 #5203

Merged
merged 2 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions server/core/config/raw/repo_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ import (
// DefaultEmojiReaction is the default emoji reaction for repos
const DefaultEmojiReaction = ""

// DefaultAbortOnExcecutionOrderFail being false is the default setting for abort on execution group failures
const DefaultAbortOnExcecutionOrderFail = false
// DefaultAbortOnExecutionOrderFail being false is the default setting for abort on execution group failures
const DefaultAbortOnExecutionOrderFail = false

// RepoCfg is the raw schema for repo-level atlantis.yaml config.
type RepoCfg struct {
Version *int `yaml:"version,omitempty"`
Projects []Project `yaml:"projects,omitempty"`
Workflows map[string]Workflow `yaml:"workflows,omitempty"`
PolicySets PolicySets `yaml:"policies,omitempty"`
AutoDiscover *AutoDiscover `yaml:"autodiscover,omitempty"`
Automerge *bool `yaml:"automerge,omitempty"`
ParallelApply *bool `yaml:"parallel_apply,omitempty"`
ParallelPlan *bool `yaml:"parallel_plan,omitempty"`
DeleteSourceBranchOnMerge *bool `yaml:"delete_source_branch_on_merge,omitempty"`
EmojiReaction *string `yaml:"emoji_reaction,omitempty"`
AllowedRegexpPrefixes []string `yaml:"allowed_regexp_prefixes,omitempty"`
AbortOnExcecutionOrderFail *bool `yaml:"abort_on_execution_order_fail,omitempty"`
RepoLocks *RepoLocks `yaml:"repo_locks,omitempty"`
SilencePRComments []string `yaml:"silence_pr_comments,omitempty"`
Version *int `yaml:"version,omitempty"`
Projects []Project `yaml:"projects,omitempty"`
Workflows map[string]Workflow `yaml:"workflows,omitempty"`
PolicySets PolicySets `yaml:"policies,omitempty"`
AutoDiscover *AutoDiscover `yaml:"autodiscover,omitempty"`
Automerge *bool `yaml:"automerge,omitempty"`
ParallelApply *bool `yaml:"parallel_apply,omitempty"`
ParallelPlan *bool `yaml:"parallel_plan,omitempty"`
DeleteSourceBranchOnMerge *bool `yaml:"delete_source_branch_on_merge,omitempty"`
EmojiReaction *string `yaml:"emoji_reaction,omitempty"`
AllowedRegexpPrefixes []string `yaml:"allowed_regexp_prefixes,omitempty"`
AbortOnExecutionOrderFail *bool `yaml:"abort_on_execution_order_fail,omitempty"`
RepoLocks *RepoLocks `yaml:"repo_locks,omitempty"`
SilencePRComments []string `yaml:"silence_pr_comments,omitempty"`
}

func (r RepoCfg) Validate() error {
Expand Down Expand Up @@ -69,9 +69,9 @@ func (r RepoCfg) ToValid() valid.RepoCfg {
emojiReaction = *r.EmojiReaction
}

abortOnExcecutionOrderFail := DefaultAbortOnExcecutionOrderFail
if r.AbortOnExcecutionOrderFail != nil {
abortOnExcecutionOrderFail = *r.AbortOnExcecutionOrderFail
abortOnExecutionOrderFail := DefaultAbortOnExecutionOrderFail
if r.AbortOnExecutionOrderFail != nil {
abortOnExecutionOrderFail = *r.AbortOnExecutionOrderFail
}

var autoDiscover *valid.AutoDiscover
Expand All @@ -84,19 +84,19 @@ func (r RepoCfg) ToValid() valid.RepoCfg {
repoLocks = r.RepoLocks.ToValid()
}
return valid.RepoCfg{
Version: *r.Version,
Projects: validProjects,
Workflows: validWorkflows,
AutoDiscover: autoDiscover,
Automerge: automerge,
ParallelApply: parallelApply,
ParallelPlan: parallelPlan,
ParallelPolicyCheck: parallelPlan,
DeleteSourceBranchOnMerge: r.DeleteSourceBranchOnMerge,
AllowedRegexpPrefixes: r.AllowedRegexpPrefixes,
EmojiReaction: emojiReaction,
AbortOnExcecutionOrderFail: abortOnExcecutionOrderFail,
RepoLocks: repoLocks,
SilencePRComments: r.SilencePRComments,
Version: *r.Version,
Projects: validProjects,
Workflows: validWorkflows,
AutoDiscover: autoDiscover,
Automerge: automerge,
ParallelApply: parallelApply,
ParallelPlan: parallelPlan,
ParallelPolicyCheck: parallelPlan,
DeleteSourceBranchOnMerge: r.DeleteSourceBranchOnMerge,
AllowedRegexpPrefixes: r.AllowedRegexpPrefixes,
EmojiReaction: emojiReaction,
AbortOnExecutionOrderFail: abortOnExecutionOrderFail,
RepoLocks: repoLocks,
SilencePRComments: r.SilencePRComments,
}
}
46 changes: 23 additions & 23 deletions server/core/config/raw/repo_cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,43 +281,43 @@ func TestConfig_ToValid(t *testing.T) {
Version: Int(2),
},
exp: valid.RepoCfg{
Version: 2,
Automerge: nil,
ParallelApply: nil,
AbortOnExcecutionOrderFail: false,
Workflows: map[string]valid.Workflow{},
Version: 2,
Automerge: nil,
ParallelApply: nil,
AbortOnExecutionOrderFail: false,
Workflows: map[string]valid.Workflow{},
},
},
{
description: "automerge, parallel_apply, abort_on_execution_order_fail true",
input: raw.RepoCfg{
Version: Int(2),
Automerge: Bool(true),
ParallelApply: Bool(true),
AbortOnExcecutionOrderFail: Bool(true),
Version: Int(2),
Automerge: Bool(true),
ParallelApply: Bool(true),
AbortOnExecutionOrderFail: Bool(true),
},
exp: valid.RepoCfg{
Version: 2,
Automerge: Bool(true),
ParallelApply: Bool(true),
AbortOnExcecutionOrderFail: true,
Workflows: map[string]valid.Workflow{},
Version: 2,
Automerge: Bool(true),
ParallelApply: Bool(true),
AbortOnExecutionOrderFail: true,
Workflows: map[string]valid.Workflow{},
},
},
{
description: "automerge, parallel_apply, abort_on_execution_order_fail false",
input: raw.RepoCfg{
Version: Int(2),
Automerge: Bool(false),
ParallelApply: Bool(false),
AbortOnExcecutionOrderFail: Bool(false),
Version: Int(2),
Automerge: Bool(false),
ParallelApply: Bool(false),
AbortOnExecutionOrderFail: Bool(false),
},
exp: valid.RepoCfg{
Version: 2,
Automerge: Bool(false),
ParallelApply: Bool(false),
AbortOnExcecutionOrderFail: false,
Workflows: map[string]valid.Workflow{},
Version: 2,
Automerge: Bool(false),
ParallelApply: Bool(false),
AbortOnExecutionOrderFail: false,
Workflows: map[string]valid.Workflow{},
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion server/core/config/valid/global_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const DefaultAtlantisFile = "atlantis.yaml"
// NonOverridableApplyReqs 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
// maybe something along the lines of defining overridable/non-overridable apply
// requirements in the config and removing the flag to enable policy checking.
var NonOverridableApplyReqs = []string{PoliciesPassedCommandReq}

Expand Down
4 changes: 2 additions & 2 deletions server/core/config/valid/global_cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ repos:
CustomPolicyCheck: false,
},
},
"repo-side apply reqs should include non-overrideable 'policies_passed' req when overridden and policies enabled": {
"repo-side apply reqs should include non-overridable 'policies_passed' req when overridden and policies enabled": {
gCfg: `
repos:
- id: /.*/
Expand Down Expand Up @@ -806,7 +806,7 @@ repos:
PolicyCheck: true,
},
},
"repo-side apply reqs should not include non-overrideable 'policies_passed' req when overridden and policies disabled": {
"repo-side apply reqs should not include non-overridable 'policies_passed' req when overridden and policies disabled": {
gCfg: `
repos:
- id: /.*/
Expand Down
32 changes: 16 additions & 16 deletions server/core/config/valid/repo_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ import (
// RepoCfg is the atlantis.yaml config after it's been parsed and validated.
type RepoCfg struct {
// Version is the version of the atlantis YAML file.
Version int
Projects []Project
Workflows map[string]Workflow
PolicySets PolicySets
Automerge *bool
AutoDiscover *AutoDiscover
ParallelApply *bool
ParallelPlan *bool
ParallelPolicyCheck *bool
DeleteSourceBranchOnMerge *bool
RepoLocks *RepoLocks
CustomPolicyCheck *bool
EmojiReaction string
AllowedRegexpPrefixes []string
AbortOnExcecutionOrderFail bool
SilencePRComments []string
Version int
Projects []Project
Workflows map[string]Workflow
PolicySets PolicySets
Automerge *bool
AutoDiscover *AutoDiscover
ParallelApply *bool
ParallelPlan *bool
ParallelPolicyCheck *bool
DeleteSourceBranchOnMerge *bool
RepoLocks *RepoLocks
CustomPolicyCheck *bool
EmojiReaction string
AllowedRegexpPrefixes []string
AbortOnExecutionOrderFail bool
SilencePRComments []string
}

func (r RepoCfg) FindProjectsByDirWorkspace(repoRelDir string, workspace string) []Project {
Expand Down
98 changes: 49 additions & 49 deletions server/events/apply_command_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,16 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
Description: "When first apply fails, the second don't run",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
ProjectName: "Second",
ParallelApplyEnabled: true,
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 1,
ProjectName: "Second",
ParallelApplyEnabled: true,
AbortOnExecutionOrderFail: true,
},
},
ProjectResults: []command.ProjectResult{
Expand All @@ -268,16 +268,16 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
Description: "When first apply fails, the second not will run",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
ProjectName: "Second",
ParallelApplyEnabled: true,
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 1,
ProjectName: "Second",
ParallelApplyEnabled: true,
AbortOnExecutionOrderFail: true,
},
},
ProjectResults: []command.ProjectResult{
Expand All @@ -300,25 +300,25 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
Description: "When both in a group of two succeeds, the following two will run",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 0,
ProjectName: "Second",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "Second",
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
ProjectName: "Third",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 1,
ProjectName: "Third",
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
ProjectName: "Fourth",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 1,
ProjectName: "Fourth",
AbortOnExecutionOrderFail: true,
},
},
ProjectResults: []command.ProjectResult{
Expand Down Expand Up @@ -353,25 +353,25 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
Description: "When one out of two fails, the following two will not run",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "First",
ParallelApplyEnabled: true,
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 0,
ProjectName: "Second",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "Second",
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
ProjectName: "Third",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 1,
ProjectName: "Third",
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
AbortOnExcecutionOrderFail: true,
ProjectName: "Fourth",
ExecutionOrderGroup: 1,
AbortOnExecutionOrderFail: true,
ProjectName: "Fourth",
},
},
ProjectResults: []command.ProjectResult{
Expand Down Expand Up @@ -408,14 +408,14 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
Description: "Don't block when parallel is not set",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
ProjectName: "First",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 0,
ProjectName: "First",
AbortOnExecutionOrderFail: true,
},
{
ExecutionOrderGroup: 1,
ProjectName: "Second",
AbortOnExcecutionOrderFail: true,
ExecutionOrderGroup: 1,
ProjectName: "Second",
AbortOnExecutionOrderFail: true,
},
},
ProjectResults: []command.ProjectResult{
Expand All @@ -437,7 +437,7 @@ func TestApplyCommandRunner_ExecutionOrder(t *testing.T) {
"2. dir: `` workspace: ``\n```diff\nGreat success!\n```\n\n---\n### Apply Summary\n\n2 projects, 1 successful, 0 failed, 1 errored",
},
{
Description: "Don't block when abortOnExcecutionOrderFail is not set",
Description: "Don't block when abortOnExecutionOrderFail is not set",
ProjectContexts: []command.ProjectContext{
{
ExecutionOrderGroup: 0,
Expand Down
2 changes: 1 addition & 1 deletion server/events/command/project_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type ProjectContext struct {
// The index of order group. Before planning/applying it will use to sort projects. Default is 0.
ExecutionOrderGroup int
// If plans/applies should be aborted if any prior plan/apply fails
AbortOnExcecutionOrderFail bool
AbortOnExecutionOrderFail bool
// Allows custom policy check tools outside of Conftest to run in checks
CustomPolicyCheck bool
SilencePRComments []string
Expand Down
Loading
Loading