Skip to content

Commit 175b3bb

Browse files
Prucekclaude
andcommitted
docs: deprecate .config.prowgen in favor of ci-operator config fields
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f8a810c commit 175b3bb

4 files changed

Lines changed: 94 additions & 90 deletions

File tree

content/en/architecture/ci-operator.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,9 @@ There are few extra fields that can be configured to control if or when the test
774774
* `skip_if_only_changed` Set a regex to skip triggering the job when all the changes in the pull request match (see the documentation link above).
775775
* `always_run` Set to `false` to disable automatic triggering on every PR. This deaults to `true` (run on every PR) unless `run_if_changed` or `skip_if_only_changed` is set.
776776
* `optional` Set to `true` to make the job not block merges.
777+
* `max_concurrency` Set the maximum number of concurrent runs of this job.
778+
* `disable_rehearsal` Set to `true` to prevent this test from being picked up for rehearsals.
779+
* `slack_reporter` Configure [Slack reporting](/how-tos/notification/) for this test with `channel`, `job_states_to_report`, and `report_template`.
777780

778781
**Note:** `run_if_changed`, `skip_if_only_changed`, and `always_run: true` are mutually exclusive.
779782

@@ -829,6 +832,28 @@ tests:
829832
Note that the build farms used to execute jobs run on UTC time, so time-of-day based `cron` schedules must be set with
830833
that in mind.
831834

835+
## Prowgen Configuration
836+
837+
The `prowgen` stanza in `ci-operator` configuration controls Prow job generation behavior. These fields replace the
838+
deprecated `.config.prowgen` file.
839+
840+
{{< highlight yaml >}}
841+
prowgen:
842+
private: true # mark jobs as hidden and mount git credentials for private repos
843+
expose: true # make private jobs visible in Deck
844+
disable_rehearsals: true # prevent all tests in this config from being rehearsed
845+
enable_secrets_store_csi_driver: true # use CSI Secrets Store for multi-stage credentials
846+
{{< / highlight >}}
847+
848+
The `ci-operator` config fields take precedence over `.config.prowgen` when both are set. If a field is omitted in the
849+
`ci-operator` config, the `.config.prowgen` value is used as a fallback.
850+
851+
**Note:** Repositories in the `openshift-priv` organization are automatically treated as `private: true`.
852+
853+
{{< alert title="Note" color="info" >}}
854+
The `.config.prowgen` file is deprecated. All configuration should be migrated to the `prowgen` stanza in the `ci-operator` configuration file. The `.config.prowgen` fallback is still supported but will be removed in the future.
855+
{{< /alert >}}
856+
832857
## Referencing Images
833858

834859
As `ci-operator` is OpenShift-native, all `images` used in a test workflow are stored as `ImageStreamTags`. The following

content/en/architecture/private-repositories.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ At that time, a Test Platform member will assist with creating the proper config
1414
2. When not configured to use a private `deck` instance, the logs and artifacts executed for the private repository
1515
will be publicly available on the `deck`. **Only set up such jobs when you are absolutely sure your jobs would not leak any sensitive information.**
1616

17-
To allow the CI jobs to access a private repo, drop the following file to the directory in `openshift/release` holding the
18-
`ci-operator` configuration for your repository (usually `ci-operator/config/$org/$repo`):
17+
To allow the CI jobs to access a private repo, add the `prowgen` stanza to your `ci-operator` configuration file:
1918

20-
`.config.prowgen`
2119
{{< highlight yaml >}}
22-
private: true # allows the source to be cloned from the private repo, without setting this: jobs will not succeed
23-
expose: true # allows the jobs to be displayed on the `deck` instance in which they are configured
20+
prowgen:
21+
private: true # allows the source to be cloned from the private repo, without setting this: jobs will not succeed
22+
expose: true # allows the jobs to be displayed on the `deck` instance in which they are configured
2423
{{< / highlight >}}
2524

25+
{{< alert title="Note" color="info" >}}
26+
The `.config.prowgen` file is deprecated. All prowgen configuration should be moved into the `ci-operator` configuration file under the `prowgen` stanza.
27+
{{< /alert >}}
28+
2629
## `openshift-priv` organization
2730

2831
The `openshift-priv` organization holds private forks of selected repositories. The purpose of these forks is to allow

content/en/how-tos/contributing-openshift-release.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,32 @@ Handcrafted jobs can opt to be rehearsable by including this label.
135135
All presubmits and periodics generated by `make jobs` have this label by default. Generated postsubmits will not contain
136136
it because generated postsubmits are used for promoting `images`.
137137

138-
In order to opt-out of rehearsals for generated presubmits and periodics, prowgen must be configured to disable rehearsals.
139-
To do this your org or repo's `.config.prowgen` file can be configured to either disable **all** rehearsals:
138+
In order to opt-out of rehearsals for generated presubmits and periodics, rehearsals can be disabled in the `ci-operator`
139+
configuration file. To disable rehearsals for **all** tests in a configuration, use the `prowgen` stanza:
140140

141141
{{< highlight yaml >}}
142-
rehearsals:
143-
disable_all: true
142+
prowgen:
143+
disable_rehearsals: true
144144
{{< / highlight >}}
145145

146-
Or to disable them for specific tests:
146+
To disable rehearsals for a **specific** test, use the `disable_rehearsal` field on the test:
147147

148148
{{< highlight yaml >}}
149-
rehearsals:
150-
disabled_rehearsals:
151-
- unit # only disable rehearsals on the job named "unit"
149+
tests:
150+
- as: "unit"
151+
commands: "make test"
152+
container:
153+
from: "bin"
154+
disable_rehearsal: true
152155
{{< / highlight >}}
153156

154-
Either of the preceding configurations will result in the `pj-rehearse.openshift.io/can-be-rehearsed: "true"` label not
157+
Either of the preceding configurations will result in the `pj-rehearse.openshift.io/can-be-rehearsed: "true"` label not
155158
being added to the affected jobs when running `make jobs`.
156159

160+
{{< alert title="Note" color="info" >}}
161+
The `.config.prowgen` file `rehearsals` section is deprecated. The `rehearsals.disable_all` and `rehearsals.disabled_rehearsals` fields in `.config.prowgen` are still supported as a fallback, but new configuration should use the `ci-operator` config fields above.
162+
{{< /alert >}}
163+
157164
{{< alert title="Warning" color="warning" >}}
158165
Jobs that are marked as `hidden: true` will never be rehearsed, regardless of the presence of the `pj-rehearse.openshift.io/can-be-rehearsed: "true"` label.
159166
{{< /alert >}}

content/en/how-tos/notification.md

Lines changed: 45 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,70 @@ title: "Set Up Slack Alerts for Job Results"
33
description: How to set up alerting to Slack for a CI job.
44
---
55

6-
We can set up Slack alerts for job results by defining `reporter_config` in the job definition. This is possible for all job types: `periodics`, `presubmits`, and `postsubmits`.
7-
`Prowgen` is [capable](https://docs.ci.openshift.org/how-tos/notification/#setting-up-slack-notifications-with-prowgen) of adding this to the job definition.
6+
We can set up Slack alerts for job results by configuring the `slack_reporter` field on individual tests in the `ci-operator` configuration file. This is possible for all job types: `periodics`, `presubmits`, and `postsubmits`.
87

9-
{{< alert title="Warning" color="warning" >}}
10-
Currently, it is still possible to manually add the `reporter_config` to periodic jobs. This functionality is deprecated, and using `Prowgen` is preferred.
11-
Once a significant number of jobs have migrated to use `Prowgen`, the ability to manually edit the periodics will be removed.
12-
{{< /alert >}}
8+
## Setting up Slack notifications
9+
10+
To add Slack reporting for a test, add the `slack_reporter` field to the test in your `ci-operator` configuration:
1311

1412
```yaml
15-
reporter_config:
16-
slack:
17-
channel: '#forum'
13+
tests:
14+
- as: "unit"
15+
commands: "make test-unit"
16+
container:
17+
from: "bin"
18+
slack_reporter:
19+
channel: "#my-channel"
1820
job_states_to_report:
1921
- failure
20-
report_template: Job {{.Spec.Job}} failed.
22+
- error
23+
report_template: 'Job {{.Spec.Job}} ended with {{.Status.State}}. <{{.Status.URL}}|View logs>'
2124
```
2225
23-
For example, by the above snippet, a Slack alert will be sent out to `#forum` channel when there is a failure of the job. The alert is formatted by `report_template`.
26+
### Configuration fields
2427
25-
* The channel has to be in [coreos.slack.com](https://coreos.slack.com/).
26-
* The channel has to be public. If it is not then the `@prow` bot has to be added to it otherwise it won't be able to properly post messages.
27-
* The state in `job_states_to_report` has to be a valid Prow job state. See [upstream documentation](https://pkg.go.dev/sigs.k8s.io/prow/pkg/apis/prowjobs/v1#ProwJobState).
28-
* The value of `report_template` is a [Go template](https://golang.org/pkg/text/template/) and it will be applied to the Prow job instance. The annotations such as `{{.Spec.Job}}` will be replaced by the job name when the alert is received in Slack. See [upstream documentation](https://pkg.go.dev/sigs.k8s.io/prow/pkg/apis/prowjobs/v1#ProwJob) for more fields of a Prow job. Note that no alerts will be sent out if the template is broken, e.g., cannot be parsed or applied successfully.
28+
* `channel` (**required**) The Slack channel to report to (e.g., `#my-channel`).
29+
* `job_states_to_report` (optional) Which job states trigger a report. Defaults to `["failure", "error"]` if not set. Must be valid [Prow job states](https://pkg.go.dev/sigs.k8s.io/prow/pkg/apis/prowjobs/v1#ProwJobState).
30+
* `report_template` (optional) A [Go template](https://golang.org/pkg/text/template/) for the Slack message. Applied to the [ProwJob](https://pkg.go.dev/sigs.k8s.io/prow/pkg/apis/prowjobs/v1#ProwJob) instance. If not set, a default template is used. No alerts will be sent if the template cannot be parsed or applied.
2931

30-
## Setting up Slack notifications with Prowgen
31-
`Prowgen` is the tool that is used to generate `ProwJobs` from `ci-operator` configuration. It is possible to instruct `Prowgen` to add a `reporter_config` to specific jobs.
32-
Doing so requires creating or updating the repo (or organization) in question's `.config.prowgen` file. This YAML configuration file is stored in the repo's `ci-operator` folder.
33-
For example, `ci-tools` configuration file is found at `ci-operator/config/openshift/ci-tools/.config.prowgen`. The following example illustrates how to utilize this config to add slack notifications for jobs:
34-
35-
```yaml
36-
slack_reporter:
37-
- channel: "#slack-channel"
38-
job_states_to_report: #Accepts any ProwJob status
39-
- success
40-
- failure
41-
- error
42-
report_template: '{{if eq .Status.State "success"}} :rainbow: Job *{{.Spec.Job}}*
43-
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> :rainbow: {{else}}
44-
:volcano: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
45-
logs> :volcano: {{end}}'
46-
job_names: # Listing of job names (ci-operator's 'as' field) that this configuration applies to
47-
- unit
48-
- upload-results
49-
- lint
50-
excluded_variants: # It is possible to exclude notifications from specific variants, for example, when you don't require them from older releases
51-
- some-old-release
52-
```
32+
### Requirements
5333

54-
{{< alert title="Note" color="info" >}}
55-
Note that it is possible to include multiple `slack_reporter` entries in this config, but each `job_name` should only be included in, at most, one.
56-
{{< /alert >}}
34+
* The channel must be on [coreos.slack.com](https://coreos.slack.com/).
35+
* The channel must be public, or the `@prow` bot must be added to it.
5736

58-
{{< alert title="Note" color="info" >}}
59-
It is possible to add slack reporting for the `images` postsubmit job by adding the "images" entry to `job_names`.
60-
{{< /alert >}}
37+
### Example with defaults
6138

62-
Once the configuration is added, simply use the `make jobs` target to generate the new job definitions containing the `reporter_config`.
39+
When only `channel` is provided, defaults are applied for `job_states_to_report` and `report_template`:
6340

64-
### Slack Reporter Configuration
41+
```yaml
42+
tests:
43+
- as: "e2e"
44+
commands: "make test-e2e"
45+
container:
46+
from: "bin"
47+
slack_reporter:
48+
channel: "#my-team"
49+
```
6550

66-
The `slack_reporter` configuration supports flexible job matching with multiple approaches:
51+
This will report on `failure` and `error` states using a default template.
6752

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`)
53+
## Deprecated: `.config.prowgen` Slack configuration
7154

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
55+
{{< alert title="Warning" color="warning" >}}
56+
The `.config.prowgen` file `slack_reporter` section is deprecated. Slack reporting should be configured directly on each test using the `slack_reporter` field as shown above. The `.config.prowgen` fallback is still supported but will be removed in the future.
57+
{{< /alert >}}
7658

77-
**Examples:**
59+
The legacy `.config.prowgen` approach used a separate file (`ci-operator/config/$org/$repo/.config.prowgen`) with pattern-based job matching:
7860

7961
```yaml
8062
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
63+
- channel: "#slack-channel"
64+
job_states_to_report:
65+
- failure
66+
- error
67+
job_names:
68+
- unit
69+
- e2e
9970
```
10071

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-
103-
The `SlackReporterConfig` is provided for [reference](https://github.com/openshift/ci-tools/blob/6810ce942bbe25a06c092af8098fd2d071604a04/pkg/config/load.go#L49-L57).
72+
This is now replaced by the per-test `slack_reporter` field in the `ci-operator` configuration, which is simpler and keeps all configuration in one place.

0 commit comments

Comments
 (0)