You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/architecture/ci-operator.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -774,6 +774,9 @@ There are few extra fields that can be configured to control if or when the test
774
774
* `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).
775
775
* `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.
776
776
* `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`.
777
780
778
781
**Note:** `run_if_changed`, `skip_if_only_changed`, and `always_run: true` are mutually exclusive.
779
782
@@ -829,6 +832,28 @@ tests:
829
832
Note that the build farms used to execute jobs run on UTC time, so time-of-day based `cron` schedules must be set with
830
833
that in mind.
831
834
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
+
832
857
## Referencing Images
833
858
834
859
As `ci-operator` is OpenShift-native, all `images` used in a test workflow are stored as `ImageStreamTags`. The following
Copy file name to clipboardExpand all lines: content/en/architecture/private-repositories.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,15 +14,18 @@ At that time, a Test Platform member will assist with creating the proper config
14
14
2. When not configured to use a private `deck` instance, the logs and artifacts executed for the private repository
15
15
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.**
16
16
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:
19
18
20
-
`.config.prowgen`
21
19
{{< 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
24
23
{{< / highlight >}}
25
24
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
+
26
29
## `openshift-priv` organization
27
30
28
31
The `openshift-priv` organization holds private forks of selected repositories. The purpose of these forks is to allow
Copy file name to clipboardExpand all lines: content/en/how-tos/contributing-openshift-release.md
+16-9Lines changed: 16 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,25 +135,32 @@ Handcrafted jobs can opt to be rehearsable by including this label.
135
135
All presubmits and periodics generated by `make jobs` have this label by default. Generated postsubmits will not contain
136
136
it because generated postsubmits are used for promoting `images`.
137
137
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:
140
140
141
141
{{< highlight yaml >}}
142
-
rehearsals:
143
-
disable_all: true
142
+
prowgen:
143
+
disable_rehearsals: true
144
144
{{< / highlight >}}
145
145
146
-
Or to disable them for specific tests:
146
+
To disable rehearsals for a **specific** test, use the `disable_rehearsal` field on the test:
147
147
148
148
{{< 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
152
155
{{< / highlight >}}
153
156
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
155
158
being added to the affected jobs when running `make jobs`.
156
159
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
+
157
164
{{< alert title="Warning" color="warning" >}}
158
165
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.
Copy file name to clipboardExpand all lines: content/en/how-tos/notification.md
+45-76Lines changed: 45 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,101 +3,70 @@ title: "Set Up Slack Alerts for Job Results"
3
3
description: How to set up alerting to Slack for a CI job.
4
4
---
5
5
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`.
8
7
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:
13
11
14
12
```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"
18
20
job_states_to_report:
19
21
- failure
20
-
report_template: Job {{.Spec.Job}} failed.
22
+
- error
23
+
report_template: 'Job {{.Spec.Job}} ended with {{.Status.State}}. <{{.Status.URL}}|View logs>'
21
24
```
22
25
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
24
27
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.
29
31
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:
- 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 >}}
76
58
77
-
**Examples:**
59
+
The legacy `.config.prowgen` approach used a separate file (`ci-operator/config/$org/$repo/.config.prowgen`) with pattern-based job matching:
78
60
79
61
```yaml
80
62
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
99
70
```
100
71
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