mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-03 20:53:49 +00:00
Print execution errors (#5448)
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
This commit is contained in:
parent
54e858ff63
commit
f240894cac
1 changed files with 16 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue