From a25c9fd4bb5fb92205ed3ffb4190c2ff62653615 Mon Sep 17 00:00:00 2001 From: Arunesh Dwivedi Date: Sat, 13 Jun 2026 06:26:14 +0000 Subject: [PATCH] fix(operations): classify refs by scheme, not ParseRequestURI url.ParseRequestURI treats absolute local paths (e.g. /tmp/cm.yaml) as valid URIs, routing them through go-getter (LoadFromURI) instead of reading from disk (Load). This caused apply/assert with absolute file: paths to fail with 'found no test in '. Fix: check for a non-empty scheme to distinguish real URLs from local paths. Also handle absolute paths explicitly (no basePath prefix) before falling back to relative paths. Fixes #2735 Signed-off-by: Arunesh Dwivedi --- pkg/runner/operations/helpers.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pkg/runner/operations/helpers.go b/pkg/runner/operations/helpers.go index dedb5d650..5b0dde215 100644 --- a/pkg/runner/operations/helpers.go +++ b/pkg/runner/operations/helpers.go @@ -24,12 +24,13 @@ func fileRefOrResource(ctx context.Context, ref v1alpha1.ActionResourceRef, base if err != nil { return nil, err } - url, err := url.ParseRequestURI(ref) - if err != nil { - return resource.Load(filepath.Join(basePath, ref), true) - } else { - return resource.LoadFromURI(url, true) + if u, err := url.ParseRequestURI(ref); err == nil && u.Scheme != "" { + return resource.LoadFromURI(u, true) + } + if filepath.IsAbs(ref) { + return resource.Load(ref, true) } + return resource.Load(filepath.Join(basePath, ref), true) } return nil, errors.New("file or resource must be set") } @@ -47,12 +48,13 @@ func fileRefOrCheck(ctx context.Context, ref v1alpha1.ActionCheckRef, basePath s if err != nil { return nil, err } - url, err := url.ParseRequestURI(ref) - if err != nil { - return resource.Load(filepath.Join(basePath, ref), false) - } else { - return resource.LoadFromURI(url, false) + if u, err := url.ParseRequestURI(ref); err == nil && u.Scheme != "" { + return resource.LoadFromURI(u, false) + } + if filepath.IsAbs(ref) { + return resource.Load(ref, false) } + return resource.Load(filepath.Join(basePath, ref), false) } return nil, errors.New("file or resource must be set") }