Skip to content

Commit

Permalink
fix: ensure we handle paths correctly in dev deploy (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGedd authored Apr 23, 2024
1 parent 932e6cc commit df4aa09
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/pkg/bundle/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ 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())
}

zarfPackagePattern := `^zarf-.*\.tar\.zst$`
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)
pkgDir := filepath.Dir(path)
// get files in directory
files, err := os.ReadDir(path)
files, err := os.ReadDir(pkgDir)
if err != nil {
message.Fatalf(err, "Failed to obtain package %s: %s", pkg.Name, err.Error())
}
Expand All @@ -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())
Expand Down

0 comments on commit df4aa09

Please sign in to comment.