Skip to content

Commit

Permalink
Handle multi task workflows properly:
Browse files Browse the repository at this point in the history
Previously, multitask workflows updating
of the workflow status of each action after
the first task didn't take previous tasks into
account. Now it does.

Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Feb 1, 2024
1 parent f2c141f commit af82c36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/server/kubernetes_api_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,19 @@ func (s *KubernetesBackedServer) modifyWorkflowState(wf *v1alpha1.Workflow, wfCo
actionIndex = -1
)

seenActions := 0
for ti, task := range wf.Status.Tasks {
if wfContext.CurrentTask == task.Name {
taskIndex = ti
for ai, action := range task.Actions {
if action.Name == wfContext.CurrentAction && wfContext.CurrentActionIndex == int64(ai) {
if action.Name == wfContext.CurrentAction && (wfContext.CurrentActionIndex == int64(ai) || wfContext.CurrentActionIndex == int64(seenActions)) {
actionIndex = ai
goto cont
}
seenActions++
}
}
seenActions += len(task.Actions)
}
cont:

Expand Down

0 comments on commit af82c36

Please sign in to comment.