diff --git a/examples/jiralert.yml b/examples/jiralert.yml index 21ee72c..8776a71 100644 --- a/examples/jiralert.yml +++ b/examples/jiralert.yml @@ -34,8 +34,6 @@ receivers: project: AB # Copy all Prometheus labels into separate JIRA labels. Optional (default: false). add_group_labels: false - # Include ticket update as comment too. Optional (default: false). - update_in_comment: false # Will be merged with the static_labels from the default map static_labels: ["anotherLabel"] @@ -58,7 +56,9 @@ receivers: # # Automatically resolve jira issues when alert is resolved. Optional. If declared, ensure state is not an empty string. auto_resolve: - state: 'Done' + state: 'Done' + # Include ticket update as comment. Optional (default: false). + update_in_comment: false # File containing template definitions. Required. template: jiralert.tmpl diff --git a/pkg/config/config.go b/pkg/config/config.go index 07ea712..2b8dd99 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -314,9 +314,6 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error { if len(c.Defaults.StaticLabels) > 0 { rc.StaticLabels = append(rc.StaticLabels, c.Defaults.StaticLabels...) } - if ! rc.UpdateInComment { - rc.UpdateInComment = c.Defaults.UpdateInComment - } } if len(c.Receivers) == 0 { diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index e370aa6..222e148 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -333,10 +333,11 @@ func TestReceiverOverrides(t *testing.T) { {"WontFixResolution", "Won't Fix", "Won't Fix"}, {"AddGroupLabels", false, false}, {"UpdateInComment", false, false}, + {"UpdateInComment", true, true}, {"AutoResolve", &AutoResolve{State: "Done"}, &autoResolve}, {"StaticLabels", []string{"somelabel"}, []string{"somelabel"}}, } { - optionalFields := []string{"Priority", "Description", "WontFixResolution", "AddGroupLabels", "UpdateInComment", "AutoResolve", "StaticLabels"} + optionalFields := []string{"Priority", "Description", "WontFixResolution", "AddGroupLabels", "AutoResolve", "StaticLabels"} defaultsConfig := newReceiverTestConfig(mandatoryReceiverFields(), optionalFields) receiverConfig := newReceiverTestConfig([]string{"Name"}, optionalFields) @@ -388,8 +389,6 @@ func newReceiverTestConfig(mandatory []string, optional []string) *receiverTestC var value reflect.Value if name == "AddGroupLabels" { value = reflect.ValueOf(true) - } else if name == "UpdateInComment" { - value = reflect.ValueOf(true) } else if name == "AutoResolve" { value = reflect.ValueOf(&AutoResolve{State: "Done"}) } else if name == "StaticLabels" {