Set Up Slack Alerts for Job Results
We can set up Slack alerts for job results by configuring the reporter_config field on individual tests in the ci-operator configuration file. This is possible for all job types: periodics, presubmits, and postsubmits.
Setting up Slack notifications
To add Slack reporting for a test, add the reporter_config field to the test in your ci-operator configuration:
Configuration fields
channel(required) The Slack channel to report to (e.g.,#my-channel).job_states_to_report(optional) Which job states trigger a report. Defaults to["success", "failure", "error"]if not set. Must be valid Prow job states.report_template(optional) A Go template for the Slack message. Applied to the ProwJob instance. If not set, Prow uses its built-in default template. No alerts will be sent if the template cannot be parsed or applied.report_presubmit(optional) Only relevant for periodic tests withpresubmit: true. When set totrue, the Slack config also applies to the presubmit job generated from the periodic. By default, periodic-only Slack config does not carry over to the presubmit.
Requirements
- The channel must be on coreos.slack.com.
- The channel must be public, or the
@prowbot must be added to it.
Example with defaults
When only channel is provided, defaults are applied for job_states_to_report and report_template:
This will report on success, failure, and error states using Prow’s default template.
Deprecated: .config.prowgen Slack configuration
The legacy .config.prowgen approach used a separate file (ci-operator/config/$org/$repo/.config.prowgen) with pattern-based job matching:
This is now replaced by the per-test reporter_config field in the ci-operator configuration, which is simpler and keeps all configuration in one place.