diff --git a/cli/exec/exec.go b/cli/exec/exec.go index 09db3cbea..c5be7ec1f 100644 --- a/cli/exec/exec.go +++ b/cli/exec/exec.go @@ -29,6 +29,7 @@ import ( "github.com/oklog/ulid/v2" "github.com/rs/zerolog/log" "github.com/urfave/cli/v3" + "go.uber.org/multierr" "go.woodpecker-ci.org/woodpecker/v3/cli/common" "go.woodpecker-ci.org/woodpecker/v3/cli/lint" @@ -78,8 +79,11 @@ func execDir(ctx context.Context, c *cli.Command, dir string) error { if runtime.GOOS == "windows" { repoPath = convertPathForWindows(repoPath) } + + var execErr error + // TODO: respect depends_on and do parallel runs with output to multiple _windows_ e.g. tmux like - return filepath.Walk(dir, func(path string, info os.FileInfo, e error) error { + walkErr := filepath.Walk(dir, func(path string, info os.FileInfo, e error) error { if e != nil { return e } @@ -87,13 +91,23 @@ func execDir(ctx context.Context, c *cli.Command, dir string) error { // check if it is a regular file (not dir) if info.Mode().IsRegular() && (strings.HasSuffix(info.Name(), ".yaml") || strings.HasSuffix(info.Name(), ".yml")) { fmt.Println("#", info.Name()) - _ = runExec(ctx, c, path, repoPath, false) // TODO: should we drop errors or store them and report back? + err := runExec(ctx, c, path, repoPath, false) + if err != nil { + fmt.Print(err) + execErr = multierr.Append(execErr, err) + } fmt.Println("") return nil } return nil }) + + if walkErr != nil { + return walkErr + } + + return execErr } func execFile(ctx context.Context, c *cli.Command, file string) error {