Skip to content

Commit c8e1170

Browse files
committed
fix: --path flag in update
Recent changes have resulted in the `wolfictl update --path` flag breaking. This flag allows for working with a repo where the melange yaml's are in a subdir such as `./packages` of the repo. > ℹ️ | 2024/01/31 00:40:50 wolfictl update: attempt 1: failed to update packages in git repository: failed to parse open docker-compose.yaml: no such file or directory
1 parent 791af07 commit c8e1170

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/update/update.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func (o *Options) updateGitPackage(ctx context.Context, repo *git.Repository, pa
369369
root := worktree.Filesystem.Root()
370370
log.Printf("working directory: %s", root)
371371

372-
configFile := filepath.Join(root, pc.Filename)
372+
configFile := filepath.Join(pc.Dir, pc.Filename)
373373
if configFile == "" {
374374
return "", fmt.Errorf("no config filename found for package %s", packageName)
375375
}
@@ -416,7 +416,7 @@ func (o *Options) updateGitPackage(ctx context.Context, repo *git.Repository, pa
416416
}
417417

418418
// now make sure update config is configured
419-
updated, err := config.ParseConfiguration(ctx, filepath.Join(root, pc.Filename))
419+
updated, err := config.ParseConfiguration(ctx, filepath.Join(pc.Dir, pc.Filename))
420420
if err != nil {
421421
return "", fmt.Errorf("failed to parse %v", err)
422422
}
@@ -435,7 +435,7 @@ func (o *Options) updateGitPackage(ctx context.Context, repo *git.Repository, pa
435435

436436
// Skip any processing for definitions with a single pipeline
437437
if len(updated.Pipeline) > 1 {
438-
if err := o.updateGoBumpDeps(updated, root, pc.Filename, mutations); err != nil {
438+
if err := o.updateGoBumpDeps(updated, pc.Dir, pc.Filename, mutations); err != nil {
439439
return fmt.Sprintf("error cleaning up go/bump deps: %v", err), nil
440440
}
441441
}
@@ -447,7 +447,7 @@ func (o *Options) updateGitPackage(ctx context.Context, repo *git.Repository, pa
447447
o.Logger.Printf("after clean go bumps: %s git status: %s", packageName, string(rs))
448448

449449
// Run yam formatter
450-
err = yam.FormatConfigurationFile(root, pc.Filename)
450+
err = yam.FormatConfigurationFile(pc.Dir, pc.Filename)
451451
if err != nil {
452452
return fmt.Sprintf("failed to format configuration file: %v", err), nil
453453
}

0 commit comments

Comments
 (0)