Skip to content

Commit 2430945

Browse files
authored
fix jira override behaviour (#135)
1 parent 033f3d5 commit 2430945

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

pkg/merger/merger.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ func MergeConfigFiles(
5050
if config.Integrations.Jira == nil {
5151
config.Integrations.Jira = extraConfig.Integrations.Jira
5252
} else {
53+
if extraConfig.Integrations.Jira.ProjectKey != "" {
54+
config.Integrations.Jira.ProjectKey = extraConfig.Integrations.Jira.ProjectKey
55+
}
56+
if extraConfig.Integrations.Jira.IssueType != "" {
57+
config.Integrations.Jira.IssueType = extraConfig.Integrations.Jira.IssueType
58+
}
59+
if extraConfig.Integrations.Jira.OnFixTransition != "" {
60+
config.Integrations.Jira.OnFixTransition = extraConfig.Integrations.Jira.OnFixTransition
61+
}
62+
if extraConfig.Integrations.Jira.Disabled {
63+
config.Integrations.Jira.Disabled = extraConfig.Integrations.Jira.Disabled
64+
}
65+
if extraConfig.Integrations.Jira.SeverityThreshold != "" {
66+
config.Integrations.Jira.SeverityThreshold = extraConfig.Integrations.Jira.SeverityThreshold
67+
}
68+
5369
if extraConfig.Integrations.Jira.Priorities != nil {
5470
config.Integrations.Jira.Priorities = extraConfig.Integrations.Jira.Priorities
5571
}

pkg/merger/merger_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,36 @@ func TestMergeJira(t *testing.T) {
524524
},
525525
},
526526
},
527+
{
528+
name: "Jira repo config with project key overriding",
529+
globalConfig: &models.Configuration{
530+
Integrations: models.Integrations{
531+
Jira: &models.Jira{
532+
ProjectKey: "projectkey1",
533+
IssueType: "issuetype1",
534+
},
535+
},
536+
},
537+
repoConfig: &models.Configuration{
538+
Integrations: models.Integrations{
539+
Jira: &models.Jira{
540+
ProjectKey: "projectkey2",
541+
},
542+
},
543+
},
544+
expected: &models.Configuration{
545+
EnablePullRequestReviews: models.Bool(true),
546+
EnableIssueDashboards: models.Bool(true),
547+
SeverityThreshold: parser.DefaultSeverityThreshold,
548+
PriorityThreshold: parser.DefaultPriorityThreshold,
549+
Integrations: models.Integrations{
550+
Jira: &models.Jira{
551+
ProjectKey: "projectkey2",
552+
IssueType: "issuetype1",
553+
},
554+
},
555+
},
556+
},
527557
{
528558
name: "secrets custom patterns global",
529559
globalConfig: &models.Configuration{

0 commit comments

Comments
 (0)