Skip to content

Commit 6ed7e06

Browse files
committed
HYPERFLEET-991 - feat: add PR risk scoring presubmit job
Add a new step-registry ref `hyperfleet-risk-scorer` that computes a deterministic risk score for PRs based on diff size, sensitive path changes, and test coverage. The job applies a risk/low, risk/medium, or risk/high GitHub label and posts a score breakdown comment. The job is configured as optional (never blocks merge) and uses the `hyperfleet-ci-bot` GitHub App for API access. Enabled for: hyperfleet-adapter, hyperfleet-api, hyperfleet-broker, hyperfleet-sentinel.
1 parent 2552e0d commit 6ed7e06

12 files changed

Lines changed: 625 additions & 0 deletions

ci-operator/config/openshift-hyperfleet/hyperfleet-adapter/openshift-hyperfleet-hyperfleet-adapter-main.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ tests:
2525
steps:
2626
test:
2727
- ref: hyperfleet-commitlint
28+
- as: risk-scorer
29+
optional: true
30+
steps:
31+
test:
32+
- ref: hyperfleet-risk-scorer
2833
- as: lint
2934
commands: |
3035
export HOME=/tmp

ci-operator/config/openshift-hyperfleet/hyperfleet-api/openshift-hyperfleet-hyperfleet-api-main.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ tests:
3737
steps:
3838
test:
3939
- ref: hyperfleet-commitlint
40+
- as: risk-scorer
41+
optional: true
42+
steps:
43+
test:
44+
- ref: hyperfleet-risk-scorer
4045
- as: lint
4146
capabilities:
4247
- nested-podman

ci-operator/config/openshift-hyperfleet/hyperfleet-broker/openshift-hyperfleet-hyperfleet-broker-main.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ tests:
2525
steps:
2626
test:
2727
- ref: hyperfleet-commitlint
28+
- as: risk-scorer
29+
optional: true
30+
steps:
31+
test:
32+
- ref: hyperfleet-risk-scorer
2833
- as: lint
2934
commands: |
3035
export HOME=/tmp

ci-operator/config/openshift-hyperfleet/hyperfleet-sentinel/openshift-hyperfleet-hyperfleet-sentinel-main.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ tests:
3737
steps:
3838
test:
3939
- ref: hyperfleet-commitlint
40+
- as: risk-scorer
41+
optional: true
42+
steps:
43+
test:
44+
- ref: hyperfleet-risk-scorer
4045
- as: lint
4146
capabilities:
4247
- nested-podman

ci-operator/jobs/openshift-hyperfleet/hyperfleet-adapter/openshift-hyperfleet-hyperfleet-adapter-main-presubmits.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,87 @@ presubmits:
355355
secret:
356356
secretName: result-aggregator
357357
trigger: (?m)^/test( | .* )presubmits-integration,?($|\s.*)
358+
- agent: kubernetes
359+
always_run: true
360+
branches:
361+
- ^main$
362+
- ^main-
363+
cluster: build11
364+
context: ci/prow/risk-scorer
365+
decorate: true
366+
decoration_config:
367+
skip_cloning: true
368+
labels:
369+
ci.openshift.io/generator: prowgen
370+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
371+
name: pull-ci-openshift-hyperfleet-hyperfleet-adapter-main-risk-scorer
372+
optional: true
373+
rerun_command: /test risk-scorer
374+
spec:
375+
containers:
376+
- args:
377+
- --gcs-upload-secret=/secrets/gcs/service-account.json
378+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
379+
- --lease-server-credentials-file=/etc/boskos/credentials
380+
- --oauth-token-path=/usr/local/github-credentials/oauth
381+
- --report-credentials-file=/etc/report/credentials
382+
- --target=risk-scorer
383+
command:
384+
- ci-operator
385+
env:
386+
- name: HTTP_SERVER_IP
387+
valueFrom:
388+
fieldRef:
389+
fieldPath: status.podIP
390+
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
391+
imagePullPolicy: Always
392+
name: ""
393+
ports:
394+
- containerPort: 8080
395+
name: http
396+
resources:
397+
requests:
398+
cpu: 10m
399+
volumeMounts:
400+
- mountPath: /etc/boskos
401+
name: boskos
402+
readOnly: true
403+
- mountPath: /secrets/gcs
404+
name: gcs-credentials
405+
readOnly: true
406+
- mountPath: /usr/local/github-credentials
407+
name: github-credentials-openshift-ci-robot-private-git-cloner
408+
readOnly: true
409+
- mountPath: /secrets/manifest-tool
410+
name: manifest-tool-local-pusher
411+
readOnly: true
412+
- mountPath: /etc/pull-secret
413+
name: pull-secret
414+
readOnly: true
415+
- mountPath: /etc/report
416+
name: result-aggregator
417+
readOnly: true
418+
serviceAccountName: ci-operator
419+
volumes:
420+
- name: boskos
421+
secret:
422+
items:
423+
- key: credentials
424+
path: credentials
425+
secretName: boskos-credentials
426+
- name: github-credentials-openshift-ci-robot-private-git-cloner
427+
secret:
428+
secretName: github-credentials-openshift-ci-robot-private-git-cloner
429+
- name: manifest-tool-local-pusher
430+
secret:
431+
secretName: manifest-tool-local-pusher
432+
- name: pull-secret
433+
secret:
434+
secretName: registry-pull-credentials
435+
- name: result-aggregator
436+
secret:
437+
secretName: result-aggregator
438+
trigger: (?m)^/test( | .* )risk-scorer,?($|\s.*)
358439
- agent: kubernetes
359440
always_run: true
360441
branches:

ci-operator/jobs/openshift-hyperfleet/hyperfleet-api/openshift-hyperfleet-hyperfleet-api-main-presubmits.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,87 @@ presubmits:
406406
secret:
407407
secretName: result-aggregator
408408
trigger: (?m)^/test( | .* )presubmits-integration,?($|\s.*)
409+
- agent: kubernetes
410+
always_run: true
411+
branches:
412+
- ^main$
413+
- ^main-
414+
cluster: build11
415+
context: ci/prow/risk-scorer
416+
decorate: true
417+
decoration_config:
418+
skip_cloning: true
419+
labels:
420+
ci.openshift.io/generator: prowgen
421+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
422+
name: pull-ci-openshift-hyperfleet-hyperfleet-api-main-risk-scorer
423+
optional: true
424+
rerun_command: /test risk-scorer
425+
spec:
426+
containers:
427+
- args:
428+
- --gcs-upload-secret=/secrets/gcs/service-account.json
429+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
430+
- --lease-server-credentials-file=/etc/boskos/credentials
431+
- --oauth-token-path=/usr/local/github-credentials/oauth
432+
- --report-credentials-file=/etc/report/credentials
433+
- --target=risk-scorer
434+
command:
435+
- ci-operator
436+
env:
437+
- name: HTTP_SERVER_IP
438+
valueFrom:
439+
fieldRef:
440+
fieldPath: status.podIP
441+
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
442+
imagePullPolicy: Always
443+
name: ""
444+
ports:
445+
- containerPort: 8080
446+
name: http
447+
resources:
448+
requests:
449+
cpu: 10m
450+
volumeMounts:
451+
- mountPath: /etc/boskos
452+
name: boskos
453+
readOnly: true
454+
- mountPath: /secrets/gcs
455+
name: gcs-credentials
456+
readOnly: true
457+
- mountPath: /usr/local/github-credentials
458+
name: github-credentials-openshift-ci-robot-private-git-cloner
459+
readOnly: true
460+
- mountPath: /secrets/manifest-tool
461+
name: manifest-tool-local-pusher
462+
readOnly: true
463+
- mountPath: /etc/pull-secret
464+
name: pull-secret
465+
readOnly: true
466+
- mountPath: /etc/report
467+
name: result-aggregator
468+
readOnly: true
469+
serviceAccountName: ci-operator
470+
volumes:
471+
- name: boskos
472+
secret:
473+
items:
474+
- key: credentials
475+
path: credentials
476+
secretName: boskos-credentials
477+
- name: github-credentials-openshift-ci-robot-private-git-cloner
478+
secret:
479+
secretName: github-credentials-openshift-ci-robot-private-git-cloner
480+
- name: manifest-tool-local-pusher
481+
secret:
482+
secretName: manifest-tool-local-pusher
483+
- name: pull-secret
484+
secret:
485+
secretName: registry-pull-credentials
486+
- name: result-aggregator
487+
secret:
488+
secretName: result-aggregator
489+
trigger: (?m)^/test( | .* )risk-scorer,?($|\s.*)
409490
- agent: kubernetes
410491
always_run: true
411492
branches:

ci-operator/jobs/openshift-hyperfleet/hyperfleet-broker/openshift-hyperfleet-hyperfleet-broker-main-presubmits.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,87 @@ presubmits:
207207
secret:
208208
secretName: result-aggregator
209209
trigger: (?m)^/test( | .* )presubmits-integration,?($|\s.*)
210+
- agent: kubernetes
211+
always_run: true
212+
branches:
213+
- ^main$
214+
- ^main-
215+
cluster: build06
216+
context: ci/prow/risk-scorer
217+
decorate: true
218+
decoration_config:
219+
skip_cloning: true
220+
labels:
221+
ci.openshift.io/generator: prowgen
222+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
223+
name: pull-ci-openshift-hyperfleet-hyperfleet-broker-main-risk-scorer
224+
optional: true
225+
rerun_command: /test risk-scorer
226+
spec:
227+
containers:
228+
- args:
229+
- --gcs-upload-secret=/secrets/gcs/service-account.json
230+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
231+
- --lease-server-credentials-file=/etc/boskos/credentials
232+
- --oauth-token-path=/usr/local/github-credentials/oauth
233+
- --report-credentials-file=/etc/report/credentials
234+
- --target=risk-scorer
235+
command:
236+
- ci-operator
237+
env:
238+
- name: HTTP_SERVER_IP
239+
valueFrom:
240+
fieldRef:
241+
fieldPath: status.podIP
242+
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
243+
imagePullPolicy: Always
244+
name: ""
245+
ports:
246+
- containerPort: 8080
247+
name: http
248+
resources:
249+
requests:
250+
cpu: 10m
251+
volumeMounts:
252+
- mountPath: /etc/boskos
253+
name: boskos
254+
readOnly: true
255+
- mountPath: /secrets/gcs
256+
name: gcs-credentials
257+
readOnly: true
258+
- mountPath: /usr/local/github-credentials
259+
name: github-credentials-openshift-ci-robot-private-git-cloner
260+
readOnly: true
261+
- mountPath: /secrets/manifest-tool
262+
name: manifest-tool-local-pusher
263+
readOnly: true
264+
- mountPath: /etc/pull-secret
265+
name: pull-secret
266+
readOnly: true
267+
- mountPath: /etc/report
268+
name: result-aggregator
269+
readOnly: true
270+
serviceAccountName: ci-operator
271+
volumes:
272+
- name: boskos
273+
secret:
274+
items:
275+
- key: credentials
276+
path: credentials
277+
secretName: boskos-credentials
278+
- name: github-credentials-openshift-ci-robot-private-git-cloner
279+
secret:
280+
secretName: github-credentials-openshift-ci-robot-private-git-cloner
281+
- name: manifest-tool-local-pusher
282+
secret:
283+
secretName: manifest-tool-local-pusher
284+
- name: pull-secret
285+
secret:
286+
secretName: registry-pull-credentials
287+
- name: result-aggregator
288+
secret:
289+
secretName: result-aggregator
290+
trigger: (?m)^/test( | .* )risk-scorer,?($|\s.*)
210291
- agent: kubernetes
211292
always_run: true
212293
branches:

ci-operator/jobs/openshift-hyperfleet/hyperfleet-sentinel/openshift-hyperfleet-hyperfleet-sentinel-main-presubmits.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,87 @@ presubmits:
406406
secret:
407407
secretName: result-aggregator
408408
trigger: (?m)^/test( | .* )presubmits-integration,?($|\s.*)
409+
- agent: kubernetes
410+
always_run: true
411+
branches:
412+
- ^main$
413+
- ^main-
414+
cluster: build11
415+
context: ci/prow/risk-scorer
416+
decorate: true
417+
decoration_config:
418+
skip_cloning: true
419+
labels:
420+
ci.openshift.io/generator: prowgen
421+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
422+
name: pull-ci-openshift-hyperfleet-hyperfleet-sentinel-main-risk-scorer
423+
optional: true
424+
rerun_command: /test risk-scorer
425+
spec:
426+
containers:
427+
- args:
428+
- --gcs-upload-secret=/secrets/gcs/service-account.json
429+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
430+
- --lease-server-credentials-file=/etc/boskos/credentials
431+
- --oauth-token-path=/usr/local/github-credentials/oauth
432+
- --report-credentials-file=/etc/report/credentials
433+
- --target=risk-scorer
434+
command:
435+
- ci-operator
436+
env:
437+
- name: HTTP_SERVER_IP
438+
valueFrom:
439+
fieldRef:
440+
fieldPath: status.podIP
441+
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
442+
imagePullPolicy: Always
443+
name: ""
444+
ports:
445+
- containerPort: 8080
446+
name: http
447+
resources:
448+
requests:
449+
cpu: 10m
450+
volumeMounts:
451+
- mountPath: /etc/boskos
452+
name: boskos
453+
readOnly: true
454+
- mountPath: /secrets/gcs
455+
name: gcs-credentials
456+
readOnly: true
457+
- mountPath: /usr/local/github-credentials
458+
name: github-credentials-openshift-ci-robot-private-git-cloner
459+
readOnly: true
460+
- mountPath: /secrets/manifest-tool
461+
name: manifest-tool-local-pusher
462+
readOnly: true
463+
- mountPath: /etc/pull-secret
464+
name: pull-secret
465+
readOnly: true
466+
- mountPath: /etc/report
467+
name: result-aggregator
468+
readOnly: true
469+
serviceAccountName: ci-operator
470+
volumes:
471+
- name: boskos
472+
secret:
473+
items:
474+
- key: credentials
475+
path: credentials
476+
secretName: boskos-credentials
477+
- name: github-credentials-openshift-ci-robot-private-git-cloner
478+
secret:
479+
secretName: github-credentials-openshift-ci-robot-private-git-cloner
480+
- name: manifest-tool-local-pusher
481+
secret:
482+
secretName: manifest-tool-local-pusher
483+
- name: pull-secret
484+
secret:
485+
secretName: registry-pull-credentials
486+
- name: result-aggregator
487+
secret:
488+
secretName: result-aggregator
489+
trigger: (?m)^/test( | .* )risk-scorer,?($|\s.*)
409490
- agent: kubernetes
410491
always_run: true
411492
branches:

0 commit comments

Comments
 (0)