Print execution errors (#5448)

Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
This commit is contained in:
qwerty287 2025-08-21 14:34:50 +02:00 committed by GitHub
parent 54e858ff63
commit f240894cac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {