Skip to content

Commit

Permalink
added a check for the absence of a tag at all
Browse files Browse the repository at this point in the history
Signed-off-by: Makarii Balashov <[email protected]>
  • Loading branch information
ya-makariy committed Jul 8, 2024
1 parent c760bee commit c8f6110
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions catalog/dockerfile/dockerfile-deny-latest-image.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
apiVersion: json.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
name: dockerfile-deny-latest-image-tag
labels:
dockerfile.tags.kyverno.io: 'dockerfile'
annotations:
description.policy.kyverno.io: This Policy ensures that no image uses the latest
tag in Dockerfile or not use tag at all.
title.policy.kyverno.io: Dockerfile latest image tag not allowed
description.policy.kyverno.io: This Policy ensures that no image uses the latest tag in Dockerfile.
creationTimestamp: null
labels:
dockerfile.tags.kyverno.io: dockerfile
name: dockerfile-deny-latest-image-tag
spec:
rules:
- name: check-latest-tag
assert:
all:
- message: "Latest tag is not allowed"
check:
~.(Stages[].From.Image):
(contains(@, ':latest')): false
- assert:
all:
- check:
~.(Stages[].From.Image):
(contains(@, ':latest')): false
message: Latest tag is not allowed
- check:
~.(Stages[].From.Image):
(!contains(@, ':')): false
message: Image without tag is not allowed
name: check-latest-tag

0 comments on commit c8f6110

Please sign in to comment.