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

Remove slack_reporter from prow config #21886

Merged
merged 2 commits into from
Apr 21, 2021
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
2 changes: 1 addition & 1 deletion prow/cmd/crier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
31 changes: 9 additions & 22 deletions prow/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down Expand Up @@ -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 {
Expand Down
46 changes: 0 additions & 46 deletions prow/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 0 additions & 10 deletions prow/config/prow-config-documented.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ' '
Expand Down