Created
February 23, 2023 20:00
-
-
Save abdennebi/f21148bfec39400814e51ee1091e71e0 to your computer and use it in GitHub Desktop.
Kyverno policy to check code review attestation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: kyverno.io/v1 | |
kind: ClusterPolicy | |
metadata: | |
name: attest-code-review | |
spec: | |
validationFailureAction: Enforce | |
background: false | |
webhookTimeoutSeconds: 30 | |
failurePolicy: Fail | |
rules: | |
- name: attest | |
match: | |
any: | |
- resources: | |
kinds: | |
- Pod | |
verifyImages: | |
- imageReferences: | |
- "registry.io/org/app*" | |
attestations: | |
- predicateType: https://example.com/CodeReview/v1 | |
attestors: | |
- entries: | |
- keys: | |
publicKeys: |- | |
-----BEGIN PUBLIC KEY----- | |
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzDB0FiCzAWf/BhHLpikFs6p853/G | |
3A/jt+GFbOJjpnr7vJyb28x4XnR1M5pwUUcpzIZkIgSsd+XcTnrBPVoiyw== | |
-----END PUBLIC KEY----- | |
conditions: | |
- all: | |
- key: "{{ repo.uri }}" | |
operator: Equals | |
value: "https://git-repo.com/org/app" | |
- key: "{{ repo.branch }}" | |
operator: Equals | |
value: "main" | |
- key: "{{ reviewers }}" | |
operator: In | |
value: ["ana@example.com", "bob@example.com"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment