You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-29 21:48:14 +02:00
Drop error only on purpose or else report back or log (#514)
- Remove Deadcode - Simplify Code - Drop error only on purpose
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/pipeline/backend"
|
||||
@@ -55,7 +56,9 @@ func New(spec *backend.Config, opts ...Option) *Runtime {
|
||||
// Run starts the runtime and waits for it to complete.
|
||||
func (r *Runtime) Run() error {
|
||||
defer func() {
|
||||
r.engine.Destroy(r.ctx, r.spec)
|
||||
if err := r.engine.Destroy(r.ctx, r.spec); err != nil {
|
||||
log.Error().Err(err).Msg("could not destroy engine")
|
||||
}
|
||||
}()
|
||||
|
||||
r.started = time.Now().Unix()
|
||||
@@ -105,9 +108,9 @@ func (r *Runtime) execAll(procs []*backend.Step) <-chan error {
|
||||
|
||||
func (r *Runtime) exec(proc *backend.Step) error {
|
||||
switch {
|
||||
case r.err != nil && proc.OnFailure == false:
|
||||
case r.err != nil && !proc.OnFailure:
|
||||
return nil
|
||||
case r.err == nil && proc.OnSuccess == false:
|
||||
case r.err == nil && !proc.OnSuccess:
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -135,8 +138,10 @@ func (r *Runtime) exec(proc *backend.Step) error {
|
||||
}
|
||||
|
||||
go func() {
|
||||
r.logger.Log(proc, multipart.New(rc))
|
||||
rc.Close()
|
||||
if err := r.logger.Log(proc, multipart.New(rc)); err != nil {
|
||||
log.Error().Err(err).Msg("process logging failed")
|
||||
}
|
||||
_ = rc.Close()
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user