Skip to content

Commit

Permalink
fix: correct the status of a workflow (#21)
Browse files Browse the repository at this point in the history
Co-authored-by: rick <[email protected]>
  • Loading branch information
LinuxSuRen and LinuxSuRen authored Jan 11, 2023
1 parent 5acf592 commit 8d1e637
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 9 deletions.
10 changes: 1 addition & 9 deletions cmd/argoworkflow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (e *DefaultPluginExecutor) Execute(args executor.ExecuteTemplateArgs, wf *w
if wf.Spec.WorkflowTemplateRef != nil {
name = wf.Spec.WorkflowTemplateRef.Name
}
wf.Status.Phase = wfv1.WorkflowPhase(wf.Status.Nodes[wf.Name].Phase)
status := wf.Status

p := args.Template.Plugin.Value
Expand Down Expand Up @@ -132,14 +133,6 @@ func (e *DefaultPluginExecutor) Execute(args executor.ExecuteTemplateArgs, wf *w
default:
repo.Status = strings.ToLower(string(status.Phase))
}

// try to figure out if this is the final step
for _, node := range status.Nodes {
if node.Type == wfv1.NodeTypePlugin && strings.HasSuffix(node.Name, ".onExit") {
repo.Status = "success"
break
}
}
}
if repo.PrNumber, err = strconv.Atoi(opt.Option.PR); err != nil {
err = fmt.Errorf("wrong pull-request number, %v", err)
Expand Down Expand Up @@ -169,7 +162,6 @@ func (e *DefaultPluginExecutor) Execute(args executor.ExecuteTemplateArgs, wf *w
toRemoves = append(toRemoves, key)
}
}
wf.Status.Phase = wfv1.WorkflowPhase(wf.Status.Nodes[wf.Name].Phase)
// remove useless nodes
delete(wf.Status.Nodes, wf.Name)
for _, key := range toRemoves {
Expand Down
Loading

0 comments on commit 8d1e637

Please sign in to comment.