All Policies

Disallow OpenShift Jenkins Pipeline Build Strategy

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

Policy Definition

/openshift/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 
 7    policies.kyverno.io/category: OpenShift
 8    policies.kyverno.io/severity: medium
 9    kyverno.io/kyverno-version: 1.6.0
10    policies.kyverno.io/minversion: 1.6.0
11    kyverno.io/kubernetes-version: "1.20"
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    validate:
27      message: >-
28        Jenkins Pipeline Build Strategy has been deprecated and is not allowed
29      deny: 
30        conditions:
31          all:
32          - key: "{{ keys(request.object.spec.strategy) | contains(@, 'jenkinsPipelineStrategy') }}"
33            operator: Equals
34            value: true