Skip to content
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
4 changes: 3 additions & 1 deletion pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var (
prowv1.FailureState,
prowv1.ErrorState,
}
DefaultSlackReporterReportTemplate = `{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed: Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{end}}`
)

type SlackReporterConfig struct {
Expand Down Expand Up @@ -2809,6 +2808,9 @@ type ImageConfiguration struct {
// The image name (To field) should match the cmd tool name for this to work correctly.
BuildIfAffected bool `json:"build_if_affected,omitempty"`

// SlackReporterConfig configures Slack notifications for the auto-generated images jobs.
SlackReporterConfig *SlackReporterConfig `json:"reporter_config,omitempty"`

// Items is the list of images to build.
Items []ProjectDirectoryImageBuildStepConfiguration `json:"items,omitempty"`
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/api/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions pkg/prowgen/prowgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *Pro
options.skipIfOnlyChanged = configSpec.Images.SkipIfOnlyChanged
options.pipelineRunIfChanged = configSpec.Images.PipelineRunIfChanged
options.pipelineSkipIfOnlyChanged = configSpec.Images.PipelineSkipIfOnlyChanged
options.slackReporterConfig = configSpec.Images.SlackReporterConfig
}))

if configSpec.PromotionConfiguration != nil {
jobBaseGen = newJobBaseBuilder().TestName(imagesTestName)
injectCapabilitiesForImgJobs(jobBaseGen, configSpec.Images.Items)

jobBaseGen.PodSpec.Add(Promotion(), Targets(imageTargets.UnsortedList()...))
// Note: Slack reporter config for images postsubmit is now handled in generatePostsubmitForTest
postsubmit := generatePostsubmitForTest(jobBaseGen, info)
postsubmit := generatePostsubmitForTest(jobBaseGen, info, func(options *generatePostsubmitOptions) {
options.slackReporterConfig = configSpec.Images.SlackReporterConfig
})
postsubmit.MaxConcurrency = 1
if postsubmit.Labels == nil {
postsubmit.Labels = map[string]string{}
Expand Down Expand Up @@ -275,15 +277,11 @@ func slackReporterConfig(jobName, testName string, testSlackConfig *cioperatorap
if len(jobStatesToReport) == 0 {
jobStatesToReport = cioperatorapi.DefaultSlackReporterJobStatesToReport
}
reportTemplate := testSlackConfig.ReportTemplate
if reportTemplate == "" {
reportTemplate = cioperatorapi.DefaultSlackReporterReportTemplate
}
return &prowv1.ReporterConfig{
Slack: &prowv1.SlackReporterConfig{
Channel: testSlackConfig.Channel,
JobStatesToReport: jobStatesToReport,
ReportTemplate: reportTemplate,
ReportTemplate: testSlackConfig.ReportTemplate,
},
}
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/webreg/zz_generated.ci_operator_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,16 @@ const ciOperatorReferenceYaml = "# The list of base images describe\n" +
" # PipelineSkipIfOnlyChanged is a regex that will cause the auto-generated images\n" +
" # presubmit to be skipped in the second stage of the pipeline if all changed files match the regex.\n" +
" pipeline_skip_if_only_changed: ' '\n" +
" # SlackReporterConfig configures Slack notifications for the auto-generated images jobs.\n" +
" reporter_config:\n" +
" channel: ' '\n" +
" job_states_to_report:\n" +
" - \"\"\n" +
" # ReportPresubmit controls whether the presubmit job generated from a\n" +
" # periodic test with `presubmit: true` also gets this slack config.\n" +
" # Only valid when the test has `presubmit: true`.\n" +
" report_presubmit: true\n" +
" report_template: ' '\n" +
" # RunIfChanged is a regex that will cause the auto-generated images\n" +
" # presubmit to only run if a file matching the regex is changed.\n" +
" run_if_changed: ' '\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ resources:
cpu: 500Mi
requests:
cpu: 10Mi
images:
items:
- from: base
to: test-image
reporter_config:
channel: "#images-channel"
job_states_to_report:
- failure
- error
promotion:
to:
- namespace: ci
tag: latest
tag_specification:
name: origin-v4.0
namespace: openshift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ periodics:
channel: '#periodic-only-channel'
job_states_to_report:
- error
report_template: '{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}*
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed:
Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
logs> {{end}}'
spec:
containers:
- args:
Expand Down Expand Up @@ -88,10 +84,6 @@ periodics:
- success
- failure
- error
report_template: '{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}*
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed:
Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
logs> {{end}}'
spec:
containers:
- args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@
postsubmits:
slack-report-inline/duper:
- agent: kubernetes
always_run: true
branches:
- ^master$
decorate: true
decoration_config:
skip_cloning: true
labels:
ci-operator.openshift.io/is-promotion: "true"
ci.openshift.io/generator: prowgen
max_concurrency: 1
name: branch-ci-slack-report-inline-duper-master-images
reporter_config:
slack:
channel: '#images-channel'
job_states_to_report:
- failure
- error
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --image-mirror-push-secret=/etc/push-secret/.dockerconfigjson
- --promote
- --report-credentials-file=/etc/report/credentials
- --target=[images]
command:
- ci-operator
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/push-secret
name: push-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: push-secret
secret:
secretName: registry-push-credentials-ci-central
- name: result-aggregator
secret:
secretName: result-aggregator
- agent: kubernetes
always_run: true
branches:
Expand All @@ -16,10 +81,6 @@ postsubmits:
channel: '#postsubmit-channel'
job_states_to_report:
- failure
report_template: '{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}*
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed:
Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
logs> {{end}}'
spec:
containers:
- args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,66 @@ presubmits:
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )e2e,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
context: ci/prow/images
decorate: true
decoration_config:
skip_cloning: true
labels:
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-slack-report-inline-duper-master-images
reporter_config:
slack:
channel: '#images-channel'
job_states_to_report:
- failure
- error
rerun_command: /test images
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --report-credentials-file=/etc/report/credentials
- --target=[images]
command:
- ci-operator
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /secrets/manifest-tool
name: manifest-tool-local-pusher
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: manifest-tool-local-pusher
secret:
secretName: manifest-tool-local-pusher
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )images,?($|\s.*)
- agent: kubernetes
always_run: true
branches:
Expand Down Expand Up @@ -143,10 +203,6 @@ presubmits:
job_states_to_report:
- failure
- error
report_template: '{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}*
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed:
Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
logs> {{end}}'
rerun_command: /test unit
spec:
containers:
Expand Down Expand Up @@ -216,10 +272,6 @@ presubmits:
- success
- failure
- error
report_template: '{{if eq .Status.State "success"}} :slack-green: Job *{{.Spec.Job}}*
ended with *{{.Status.State}}*. <{{.Status.URL}}|View logs> {{else}} :failed:
Job *{{.Spec.Job}}* ended with *{{.Status.State}}*. <{{.Status.URL}}|View
logs> {{end}}'
rerun_command: /test verify
spec:
containers:
Expand Down