From 80adca4be0b1be1bb6137f913d1bfe2ff3c8c363 Mon Sep 17 00:00:00 2001 From: unclegedd Date: Tue, 23 Apr 2024 14:54:56 -0500 Subject: [PATCH 1/2] fix: ensure we handle paths correctly in dev deploy --- src/pkg/bundle/dev.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkg/bundle/dev.go b/src/pkg/bundle/dev.go index 69625414..a6157ded 100644 --- a/src/pkg/bundle/dev.go +++ b/src/pkg/bundle/dev.go @@ -20,8 +20,8 @@ import ( // CreateZarfPkgs creates a zarf package if its missing when in dev mode func (b *Bundle) CreateZarfPkgs() { srcDir := b.cfg.CreateOpts.SourceDirectory - path := filepath.Join(srcDir, b.cfg.CreateOpts.BundleFile) - if err := zarfUtils.ReadYaml(path, &b.bundle); err != nil { + bundleYAMLPath := filepath.Join(srcDir, b.cfg.CreateOpts.BundleFile) + if err := zarfUtils.ReadYaml(bundleYAMLPath, &b.bundle); err != nil { message.Fatalf(err, "Failed to read bundle.yaml: %s", err.Error()) } @@ -29,9 +29,9 @@ func (b *Bundle) CreateZarfPkgs() { for _, pkg := range b.bundle.Packages { // if pkg is a local zarf package, attempt to create it if it doesn't exist if pkg.Path != "" { - path := srcDir + pkg.Path + path := getPkgPath(pkg, config.GetArch(b.bundle.Metadata.Architecture), srcDir) // get files in directory - files, err := os.ReadDir(path) + files, err := os.ReadDir(filepath.Dir(path)) if err != nil { message.Fatalf(err, "Failed to obtain package %s: %s", pkg.Name, err.Error()) } From 7b81c1423f9589eab847561eff1b3b863ae91504 Mon Sep 17 00:00:00 2001 From: unclegedd Date: Tue, 23 Apr 2024 15:18:04 -0500 Subject: [PATCH 2/2] fix --- src/pkg/bundle/dev.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pkg/bundle/dev.go b/src/pkg/bundle/dev.go index a6157ded..c36aa4dd 100644 --- a/src/pkg/bundle/dev.go +++ b/src/pkg/bundle/dev.go @@ -30,8 +30,9 @@ func (b *Bundle) CreateZarfPkgs() { // if pkg is a local zarf package, attempt to create it if it doesn't exist if pkg.Path != "" { path := getPkgPath(pkg, config.GetArch(b.bundle.Metadata.Architecture), srcDir) + pkgDir := filepath.Dir(path) // get files in directory - files, err := os.ReadDir(filepath.Dir(path)) + files, err := os.ReadDir(pkgDir) if err != nil { message.Fatalf(err, "Failed to obtain package %s: %s", pkg.Name, err.Error()) } @@ -47,7 +48,7 @@ func (b *Bundle) CreateZarfPkgs() { } // create local zarf package if it doesn't exist if !packageFound { - os.Args = []string{"zarf", "package", "create", path, "--confirm", "-o", path, "--skip-sbom"} + os.Args = []string{"zarf", "package", "create", pkgDir, "--confirm", "-o", pkgDir, "--skip-sbom"} zarfCLI.Execute() if err != nil { message.Fatalf(err, "Failed to create package %s: %s", pkg.Name, err.Error())