From d35dcf52337dc36f289565255e15c2cff3fa5d39 Mon Sep 17 00:00:00 2001 From: kskumgk63 Date: Wed, 21 Apr 2021 20:58:08 +0900 Subject: [PATCH 1/2] Remove `slack_reporter` from prow config --- prow/cmd/crier/main.go | 2 +- prow/config/config.go | 31 ++++++++----------------- prow/config/config_test.go | 46 -------------------------------------- 3 files changed, 10 insertions(+), 69 deletions(-) diff --git a/prow/cmd/crier/main.go b/prow/cmd/crier/main.go index 0730a4191d7a..70687e6d2595 100644 --- a/prow/cmd/crier/main.go +++ b/prow/cmd/crier/main.go @@ -228,7 +228,7 @@ func main() { var hasReporter bool if o.slackWorkers > 0 { - if cfg().SlackReporter == nil && cfg().SlackReporterConfigs == nil { + if cfg().SlackReporterConfigs == nil { logrus.Fatal("slackreporter is enabled but has no config") } slackConfig := func(refs *prowapi.Refs) config.SlackReporter { diff --git a/prow/config/config.go b/prow/config/config.go index ea4e51766c12..186c8c717cb8 100644 --- a/prow/config/config.go +++ b/prow/config/config.go @@ -111,17 +111,15 @@ type JobConfig struct { // ProwConfig is config for all prow controllers type ProwConfig struct { // The git sha from which this config was generated - ConfigVersionSHA string `json:"config_version_sha,omitempty"` - Tide Tide `json:"tide,omitempty"` - Plank Plank `json:"plank,omitempty"` - Sinker Sinker `json:"sinker,omitempty"` - Deck Deck `json:"deck,omitempty"` - BranchProtection BranchProtection `json:"branch-protection"` - Gerrit Gerrit `json:"gerrit"` - GitHubReporter GitHubReporter `json:"github_reporter"` - Horologium Horologium `json:"horologium"` - // Deprecated: this option will be removed in May 2020. - SlackReporter *SlackReporter `json:"slack_reporter,omitempty"` + ConfigVersionSHA string `json:"config_version_sha,omitempty"` + Tide Tide `json:"tide,omitempty"` + Plank Plank `json:"plank,omitempty"` + Sinker Sinker `json:"sinker,omitempty"` + Deck Deck `json:"deck,omitempty"` + BranchProtection BranchProtection `json:"branch-protection"` + Gerrit Gerrit `json:"gerrit"` + GitHubReporter GitHubReporter `json:"github_reporter"` + Horologium Horologium `json:"horologium"` SlackReporterConfigs SlackReporterConfigs `json:"slack_reporter_configs,omitempty"` InRepoConfig InRepoConfig `json:"in_repo_config"` @@ -1538,17 +1536,6 @@ func (c *Config) validateComponentConfig() error { } } - // TODO(@clarketm): Remove in May 2020 - if c.SlackReporter != nil { - logrus.Warning("slack_reporter will be deprecated on May 2020, and it will be replaced with slack_reporter_configs['*'].") - - if c.SlackReporterConfigs != nil { - return errors.New("slack_reporter and slack_reporter_configs['*'] are mutually exclusive") - } - - c.SlackReporterConfigs = SlackReporterConfigs{"*": *c.SlackReporter} - } - if c.SlackReporterConfigs != nil { for k, config := range c.SlackReporterConfigs { if err := config.DefaultAndValidate(); err != nil { diff --git a/prow/config/config_test.go b/prow/config/config_test.go index 778a3daf2c55..5f8f48e53834 100644 --- a/prow/config/config_test.go +++ b/prow/config/config_test.go @@ -3345,20 +3345,6 @@ func TestSlackReporterValidation(t *testing.T) { config func() Config successExpected bool }{ - { - name: "Valid config w/ slack_reporter - no error", - config: func() Config { - slack := &SlackReporter{ - Channel: "my-channel", - } - return Config{ - ProwConfig: ProwConfig{ - SlackReporter: slack, - }, - } - }, - successExpected: true, - }, { name: "Valid config w/ wildcard slack_reporter_configs - no error", config: func() Config { @@ -3407,38 +3393,6 @@ func TestSlackReporterValidation(t *testing.T) { }, successExpected: true, }, - { - name: "Invalid config b/c both slack_reporter and slack_reporter_configs - error", - config: func() Config { - slack := &SlackReporter{ - Channel: "my-channel", - } - slackCfg := map[string]SlackReporter{ - "*": { - Channel: "my-channel", - }, - } - return Config{ - ProwConfig: ProwConfig{ - SlackReporter: slack, - SlackReporterConfigs: slackCfg, - }, - } - }, - successExpected: false, - }, - { - name: "No channel w/ slack_reporter - error", - config: func() Config { - slack := &SlackReporter{} - return Config{ - ProwConfig: ProwConfig{ - SlackReporter: slack, - }, - } - }, - successExpected: false, - }, { name: "No channel w/ slack_reporter_configs - error", config: func() Config { From fc8ec10ba201fa6bcb1c6248ff7379428a03f2c8 Mon Sep 17 00:00:00 2001 From: kskumgk63 Date: Wed, 21 Apr 2021 22:23:23 +0900 Subject: [PATCH 2/2] gen yaml --- prow/config/prow-config-documented.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/prow/config/prow-config-documented.yaml b/prow/config/prow-config-documented.yaml index 90a89fe942c7..52c5cf3e6d85 100644 --- a/prow/config/prow-config-documented.yaml +++ b/prow/config/prow-config-documented.yaml @@ -943,16 +943,6 @@ sinker: # garbage collected. # Defaults to matching MaxPodAge. terminated_pod_ttl: 0s - - -# Deprecated: this option will be removed in May 2020. -slack_reporter: - channel: ' ' - job_states_to_report: - - "" - job_types_to_report: - - "" - report_template: ' ' slack_reporter_configs: "": channel: ' '