Skip to content

Commit

Permalink
fix(orchestration): mark tasks failed when the stage is marked as ign…
Browse files Browse the repository at this point in the history
…ore failure (#3114)

When a task fails due to an exception in the `execute` and the stage is marked
as 'failPipeline=false' the `RunTaskHandler` incorrectly set the task status to
FAIL_CONTINUE.
This causes subsequent tasks in the stage to run even if after a failure. This
also causes the original exception to be hidden by failures in subsequent tasks
This change corrects this behavior and treats task exceptions same as if the task
returted `TERMINAL`
  • Loading branch information
marchello2000 committed Aug 20, 2019
1 parent e1e3f9b commit 554c3ff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ class RunTaskHandler(
queue.push(CompleteTask(message, SUCCEEDED))
} else {
log.error("Error running ${message.taskType.simpleName} for ${message.executionType}[${message.executionId}]", e)
val status = stage.failureStatus(default = TERMINAL)
stage.context["exception"] = exceptionDetails
repository.storeStage(stage)
queue.push(CompleteTask(message, stage.failureStatus()))
trackResult(stage, thisInvocationStartTimeMs, taskModel, stage.failureStatus())
queue.push(CompleteTask(message, status, TERMINAL))
trackResult(stage, thisInvocationStartTimeMs, taskModel, status)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ object RunTaskHandlerTest : SubjectSpek<RunTaskHandler>({
}

it("marks the task as failed but continue") {
verify(queue).push(CompleteTask(message, FAILED_CONTINUE))
verify(queue).push(CompleteTask(message, FAILED_CONTINUE, TERMINAL))
}
}

Expand Down

0 comments on commit 554c3ff

Please sign in to comment.