From 4c05c2833c0ae2d1640d3c5b9e3f9e6205e782cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Tue, 29 Aug 2023 19:08:20 +0200 Subject: [PATCH] fix: support fully-qualified file paths in cli test command (#8163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- cmd/cli/kubectl-kyverno/test/test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/cli/kubectl-kyverno/test/test.go b/cmd/cli/kubectl-kyverno/test/test.go index c673cd11ab..e827b77a53 100644 --- a/cmd/cli/kubectl-kyverno/test/test.go +++ b/cmd/cli/kubectl-kyverno/test/test.go @@ -255,11 +255,13 @@ func applyPoliciesFromPath( func getFullPath(paths []string, policyResourcePath string, isGit bool) []string { var pols []string - var pol string if !isGit { for _, path := range paths { - pol = filepath.Join(policyResourcePath, path) - pols = append(pols, pol) + if !filepath.IsAbs(path) { + pols = append(pols, filepath.Join(policyResourcePath, path)) + } else { + pols = append(pols, path) + } } return pols }