Skip to content

Commit

Permalink
chore: cleaner failure state on workflowTracking (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
chase-crumbaugh committed Jun 27, 2024
1 parent 4341203 commit 9546895
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/workflowTracking/workflowTracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,24 @@ func (w *WorkflowStep) FailWorkflow() {
}

func (w *WorkflowStep) Fail() {
w.failLastSubstep() // Otherwise the parent step might fail even though all the child steps say "success"

if w.status == StatusRunning {
w.status = StatusFailed
w.logger.Errorf("\nStep Failed: %s\n", w.name)
}
}

func (w *WorkflowStep) failLastSubstep() {
for i, substep := range w.substeps {
if len(substep.substeps) > 0 {
substep.failLastSubstep()
} else if i == len(w.substeps)-1 { // Fail the last substep only
substep.Fail()
}
}
}

func (w *WorkflowStep) FailWorkflowWithoutNotifying() {
w.Fail()
for _, substep := range w.substeps {
Expand Down

0 comments on commit 9546895

Please sign in to comment.