You've already forked woodpecker
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:
+9
-3
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user