From 7bd29ee6f64deebafd72ec9d57cf7ca3f1dc954d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Fr=C3=B6hlich?= Date: Tue, 2 Jan 2024 23:35:48 +0100 Subject: [PATCH] fix: notation validator only on docker driver --- admissionctrl/validator/notation_validator.go | 6 ++++++ admissionctrl/validator/notation_validator_test.go | 1 + 2 files changed, 7 insertions(+) diff --git a/admissionctrl/validator/notation_validator.go b/admissionctrl/validator/notation_validator.go index 84488f0..04dd27f 100644 --- a/admissionctrl/validator/notation_validator.go +++ b/admissionctrl/validator/notation_validator.go @@ -17,6 +17,12 @@ type NotationValidator struct { func (v *NotationValidator) Validate(job *api.Job) ([]error, error) { for _, tg := range job.TaskGroups { for _, task := range tg.Tasks { + // check if the task driver is docker + // should we consider podman? + if task.Driver != "docker" { + continue + } + image, ok := task.Config["image"].(string) if !ok { continue diff --git a/admissionctrl/validator/notation_validator_test.go b/admissionctrl/validator/notation_validator_test.go index 5f6ad3b..1544d48 100644 --- a/admissionctrl/validator/notation_validator_test.go +++ b/admissionctrl/validator/notation_validator_test.go @@ -91,6 +91,7 @@ func TestNotationValidatorValidate(t *testing.T) { }{ { driver: "magic", + image: "invalidimage:latest", }, }, expectedErrors: nil,