You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-06-03 16:35:37 +02:00
Fix pipeline cancel (#6320)
This commit is contained in:
@@ -169,7 +169,11 @@ func (q *fifo) Wait(ctx context.Context, taskID string) error {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-state.done:
|
||||
// only return queue errors and no workflow errors
|
||||
// check if we have a wrapped cancel error and unwrap it
|
||||
if errors.Is(state.error, ErrCancel) {
|
||||
return ErrCancel
|
||||
}
|
||||
// or return queue errors and no workflow errors
|
||||
if !errors.Is(state.error, new(ErrExternal)) {
|
||||
return state.error
|
||||
}
|
||||
|
||||
@@ -117,13 +117,16 @@ func (s *RPC) Wait(c context.Context, workflowID string) (canceled bool, err err
|
||||
if err := s.queue.Wait(c, workflowID); err != nil {
|
||||
if errors.Is(err, queue.ErrCancel) {
|
||||
// we explicit send a cancel signal
|
||||
log.Debug().Str("workflowID", workflowID).Msg("while waiting the queue reported the workflow as canceled")
|
||||
return true, nil
|
||||
}
|
||||
// unknown error happened
|
||||
log.Error().Err(err).Str("workflowID", workflowID).Msg("while waiting the queue returned an unexpected error")
|
||||
return false, err
|
||||
}
|
||||
|
||||
// workflow finished and on issues appeared
|
||||
log.Debug().Str("workflowID", workflowID).Msg("queue reported the workflow as finished")
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user