Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a check for the absence of a tag at all in dockerfile-deny-latest-image-policy #421

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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