From 208b4c422c85ff6da4cb4c2b9755f0a23a1329c6 Mon Sep 17 00:00:00 2001 From: Natasha Sarkar Date: Fri, 29 Jul 2022 14:13:07 -0500 Subject: [PATCH] fix logic for determining root package (#3421) --- internal/pkg/pkg.go | 2 +- porch/pkg/engine/render.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go index 68b0bcf637..e4c55fa7b8 100644 --- a/internal/pkg/pkg.go +++ b/internal/pkg/pkg.go @@ -195,7 +195,7 @@ type Pkg struct { // Use ReadKptfile or ReadPipeline on the return value to read meta resources from filesystem. func New(fs filesys.FileSystem, path string) (*Pkg, error) { if !filepath.IsAbs(path) { - return nil, fmt.Errorf("need absolute path") + return nil, fmt.Errorf("provided path %s must be absolute", path) } absPath := filepath.Clean(path) pkg := &Pkg{ diff --git a/porch/pkg/engine/render.go b/porch/pkg/engine/render.go index e5ad2fd563..922a8d554f 100644 --- a/porch/pkg/engine/render.go +++ b/porch/pkg/engine/render.go @@ -92,7 +92,7 @@ func writeResources(fs filesys.FileSystem, resources repository.PackageResources if base == "Kptfile" { // Found Kptfile. Check if the current directory is ancestor of the current // topmost package directory. If so, use it instead. - if packageDir == "" || strings.HasPrefix(packageDir, dir+"/") { + if packageDir == "" || dir == "/" || strings.HasPrefix(packageDir, dir+"/") { packageDir = dir } }