1
0
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:
6543
2026-03-30 19:33:54 +02:00
committed by GitHub
parent 662575630a
commit af471c5372
5 changed files with 14 additions and 3 deletions
+5 -1
View File
@@ -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
}
+3
View File
@@ -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
}