Skip to content

Commit 9b48af1

Browse files
committed
Update doc for slackreporterconfig supporting exclude pattern
1 parent bf94fdd commit 9b48af1

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

content/en/docs/how-tos/notification.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,44 @@ It is possible to add slack reporting for the `images` postsubmit job by adding
6060
{{< /alert >}}
6161

6262
Once the configuration is added, simply use the `make jobs` target to generate the new job definitions containing the `reporter_config`.
63+
64+
### Slack Reporter Configuration
65+
66+
The `slack_reporter` configuration supports flexible job matching with multiple approaches:
67+
68+
1. **Exact matching** with `job_names`: Matches job names exactly
69+
2. **Pattern matching** with `job_name_patterns`: Matches job names using regular expressions
70+
3. **Exclusion** with `excluded_job_patterns`: Excludes jobs matching regex patterns (similar to `excluded_variants`)
71+
72+
**Matching Priority:**
73+
- Exclusions are checked first - if a job matches any `excluded_job_patterns`, it's excluded regardless of other rules
74+
- Exact matches in `job_names` take precedence over pattern matches in `job_name_patterns`
75+
- This allows for more flexible job matching while maintaining compatibility with existing configurations
76+
77+
**Examples:**
78+
79+
```yaml
80+
slack_reporter:
81+
# Example 1: Mixed exact and pattern matching
82+
- channel: "#my-team"
83+
job_names: ["unit", "images"] # Exact matches
84+
job_name_patterns: ["^e2e-.*"] # Regex patterns
85+
86+
# Example 2: Broad matching with exclusions (similar to excluded_variants)
87+
- channel: "#ops-team"
88+
job_name_patterns: [".*"] # Match all jobs
89+
excluded_job_patterns: # But exclude these patterns
90+
- ".*-skip$" # Jobs ending with "-skip"
91+
- "^nightly-.*" # Jobs starting with "nightly-"
92+
- ".*-flaky-.*" # Jobs containing "-flaky-"
93+
94+
# Example 3: Combining all approaches
95+
- channel: "#dev-team"
96+
job_names: ["critical-test"] # Always include this specific job
97+
job_name_patterns: ["^unit-.*"] # Include all unit tests
98+
excluded_job_patterns: [".*-slow$"] # But exclude slow tests
99+
```
100+
101+
The `excluded_job_patterns` approach is often simpler than complex inclusion patterns, especially when you want to match most jobs in a repository but exclude specific types.
102+
63103
The `SlackReporterConfig` is provided for [reference](https://github.com/openshift/ci-tools/blob/6810ce942bbe25a06c092af8098fd2d071604a04/pkg/config/load.go#L49-L57).

0 commit comments

Comments
 (0)