Skip to content

Commit 6cd1a7b

Browse files
authored
update the config file logic (#175)
* update the config file logic * update more files * remove from integration test
1 parent a2a0f6a commit 6cd1a7b

File tree

4 files changed

+0
-90
lines changed

4 files changed

+0
-90
lines changed

pkg/merger/merger.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,6 @@ func MergeConfigFiles(
7979
}
8080
}
8181

82-
if extraConfig.Integrations.AWS != nil {
83-
if config.Integrations.AWS == nil {
84-
config.Integrations.AWS = extraConfig.Integrations.AWS
85-
} else {
86-
config.Integrations.AWS.Enable = extraConfig.Integrations.AWS.Enable
87-
88-
config.Integrations.AWS.RoleNameToAssume = extraConfig.Integrations.AWS.RoleNameToAssume
89-
config.Integrations.AWS.PrimaryAccountID = extraConfig.Integrations.AWS.PrimaryAccountID
90-
config.Integrations.AWS.PrimaryRegion = extraConfig.Integrations.AWS.PrimaryRegion
91-
92-
if extraConfig.Integrations.AWS.PrimaryRegion != "" {
93-
config.Integrations.AWS.PrimaryRegion = extraConfig.Integrations.AWS.PrimaryRegion
94-
}
95-
if extraConfig.Integrations.AWS.TargetRegions != nil {
96-
config.Integrations.AWS.TargetRegions = extraConfig.Integrations.AWS.TargetRegions
97-
}
98-
if extraConfig.Integrations.AWS.TargetAccounts != nil {
99-
config.Integrations.AWS.TargetAccounts = extraConfig.Integrations.AWS.TargetAccounts
100-
}
101-
}
102-
}
103-
10482
if len(extraConfig.IgnoreDirs) > 0 {
10583
config.IgnoreDirs = extraConfig.IgnoreDirs
10684
}

pkg/merger/merger_test.go

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,6 @@ func TestMergeConfigFiles(t *testing.T) {
8282
SeverityThreshold: models.SeverityHigh,
8383
PriorityThreshold: models.PriorityImportant,
8484
},
85-
AWS: &models.AWS{
86-
Enable: true,
87-
RoleNameToAssume: "nullify-role",
88-
PrimaryAccountID: "123456789012",
89-
PrimaryRegion: "ap-southeast-2",
90-
TargetRegions: &[]string{"ap-southeast-2", "us-east-2"},
91-
TargetAccounts: &[]string{"123456789012", "123456789013"},
92-
},
9385
},
9486
},
9587
expected: &models.Configuration{
@@ -148,14 +140,6 @@ func TestMergeConfigFiles(t *testing.T) {
148140
SeverityThreshold: models.SeverityHigh,
149141
PriorityThreshold: models.PriorityImportant,
150142
},
151-
AWS: &models.AWS{
152-
Enable: true,
153-
RoleNameToAssume: "nullify-role",
154-
PrimaryAccountID: "123456789012",
155-
PrimaryRegion: "ap-southeast-2",
156-
TargetRegions: &[]string{"ap-southeast-2", "us-east-2"},
157-
TargetAccounts: &[]string{"123456789012", "123456789013"},
158-
},
159143
},
160144
},
161145
},
@@ -220,14 +204,6 @@ func TestMergeConfigFiles(t *testing.T) {
220204
Low: "low",
221205
},
222206
},
223-
AWS: &models.AWS{
224-
Enable: true,
225-
RoleNameToAssume: "nullify-role",
226-
PrimaryAccountID: "123456789012",
227-
PrimaryRegion: "ap-southeast-2",
228-
TargetRegions: &[]string{"ap-southeast-2", "us-east-2"},
229-
TargetAccounts: &[]string{"123456789012", "123456789013"},
230-
},
231207
},
232208
},
233209
repoConfig: nil,
@@ -293,14 +269,6 @@ func TestMergeConfigFiles(t *testing.T) {
293269
Low: "low",
294270
},
295271
},
296-
AWS: &models.AWS{
297-
Enable: true,
298-
RoleNameToAssume: "nullify-role",
299-
PrimaryAccountID: "123456789012",
300-
PrimaryRegion: "ap-southeast-2",
301-
TargetRegions: &[]string{"ap-southeast-2", "us-east-2"},
302-
TargetAccounts: &[]string{"123456789012", "123456789013"},
303-
},
304272
},
305273
},
306274
},
@@ -454,24 +422,6 @@ func TestMergeConfigFiles(t *testing.T) {
454422
},
455423
},
456424
},
457-
{
458-
name: "attack surface with AWS integration merge",
459-
globalConfig: &models.Configuration{
460-
AttackSurface: &models.AttackSurface{
461-
Enable: true,
462-
},
463-
},
464-
repoConfig: nil,
465-
expected: &models.Configuration{
466-
EnablePullRequestReviews: models.Bool(true),
467-
EnableIssueDashboards: models.Bool(true),
468-
SeverityThreshold: parser.DefaultSeverityThreshold,
469-
PriorityThreshold: parser.DefaultPriorityThreshold,
470-
AttackSurface: &models.AttackSurface{
471-
Enable: true,
472-
},
473-
},
474-
},
475425
} {
476426
t.Run(scenario.name, func(t *testing.T) {
477427
config := MergeConfigFiles(parser.NewDefaultConfig(), scenario.globalConfig, scenario.repoConfig)

pkg/models/integrations.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package models
22

33
type Integrations struct {
44
Jira *Jira `yaml:"jira,omitempty"`
5-
AWS *AWS `yaml:"aws,omitempty"`
65
}
76

87
type Jira struct {
@@ -32,12 +31,3 @@ type Assignee struct {
3231
Name string `yaml:"name,omitempty"`
3332
ID string `yaml:"id,omitempty"`
3433
}
35-
36-
type AWS struct {
37-
Enable bool `yaml:"enable"`
38-
RoleNameToAssume string `yaml:"role_name_to_assume"`
39-
PrimaryAccountID string `yaml:"primary_account_id"`
40-
PrimaryRegion string `yaml:"primary_region"`
41-
TargetRegions *[]string `yaml:"target_regions,omitempty"`
42-
TargetAccounts *[]string `yaml:"target_accounts,omitempty"`
43-
}

tests/integration_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,6 @@ func TestIntegration(t *testing.T) {
153153
PriorityThreshold: models.PriorityImportant,
154154
OnFixTransition: "Done",
155155
},
156-
AWS: &models.AWS{
157-
Enable: true,
158-
RoleNameToAssume: "nullify-role",
159-
PrimaryAccountID: "123456789012",
160-
PrimaryRegion: "ap-southeast-2",
161-
TargetRegions: &[]string{"ap-southeast-2", "us-east-2"},
162-
TargetAccounts: &[]string{"123456789012", "123456789013"},
163-
},
164156
},
165157
AttackSurface: &models.AttackSurface{
166158
Enable: true,

0 commit comments

Comments
 (0)