1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2026-06-03 16:35:37 +02:00

If agent cancels a workflow we need to report that back to the queue too (#6262)

This commit is contained in:
6543
2026-03-20 19:30:19 +01:00
committed by GitHub
parent eab8c09d0a
commit 9d32aaf558
+9 -3
View File
@@ -350,17 +350,23 @@ func (s *RPC) Done(c context.Context, strWorkflowID string, state rpc.WorkflowSt
logger.Error().Err(err).Msgf("pipeline.UpdateWorkflowStatusToDone: cannot update workflow state: %s", err)
}
var queueErr error
if !state.Canceled {
var queueErr error
if workflow.Failing() {
queueErr = s.queue.Error(c, strWorkflowID, fmt.Errorf("workflow finished with error %s", state.Error))
} else {
queueErr = s.queue.Done(c, strWorkflowID, workflow.State)
}
if queueErr != nil {
logger.Error().Err(queueErr).Msg("queue.Done: cannot ack workflow")
} else {
if workflow.Started > 0 {
queueErr = s.queue.Done(c, strWorkflowID, model.StatusKilled)
} else {
queueErr = s.queue.Done(c, strWorkflowID, model.StatusCanceled)
}
}
if queueErr != nil {
logger.Error().Err(queueErr).Msg("queue.Done: cannot ack workflow")
}
currentPipeline.Workflows, err = s.store.WorkflowGetTree(currentPipeline)
if err != nil {