All Policies

Disallow OpenShift Jenkins Pipeline Build Strategy in CEL expressions

The Jenkins Pipeline Build Strategy has been deprecated. This policy prevents its use. Use OpenShift Pipelines instead.

Policy Definition

/openshift-cel/disallow-jenkins-pipeline-strategy/disallow-jenkins-pipeline-strategy.yaml

 1apiVersion: kyverno.io/v1
 2kind: ClusterPolicy
 3metadata:
 4  name: disallow-jenkins-pipeline-strategy
 5  annotations:
 6    policies.kyverno.io/title: Disallow OpenShift Jenkins Pipeline Build Strategy in CEL expressions
 7    policies.kyverno.io/category: OpenShift in CEL 
 8    policies.kyverno.io/severity: medium
 9    kyverno.io/kyverno-version: 1.11.0
10    policies.kyverno.io/minversion: 1.11.0
11    kyverno.io/kubernetes-version: "1.26-1.27"
12    policies.kyverno.io/subject: BuildConfig
13    policies.kyverno.io/description: >-
14      The Jenkins Pipeline Build Strategy has been deprecated. This policy prevents its use. Use OpenShift Pipelines instead.
15spec:
16  validationFailureAction: Enforce
17  background: true
18  rules:
19  - name: check-build-strategy
20    match:
21      any:
22      - resources:
23          kinds:
24          - v1/BuildConfig
25          - build.openshift.io/v1/BuildConfig
26          operations:
27          - CREATE
28          - UPDATE
29    validate:
30      cel:
31        expressions:
32          - expression: "!has(object.spec.strategy.jenkinsPipelineStrategy)"
33            message: >-
34              Jenkins Pipeline Build Strategy has been deprecated and is not allowed