-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a check for the absence of a tag at all
Signed-off-by: Makarii Balashov <[email protected]>
- Loading branch information
1 parent
c760bee
commit c8f6110
Showing
1 changed file
with
17 additions
and
11 deletions.
There are no files selected for viewing
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
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 |