lifecycle: successful prestart tasks should not fail deployments

In 492d62d we prevented poststop tasks from contributing to allocation health
status, which fixed a bug where poststop tasks would prevent a deployment from
ever being marked successful. The patch introduced a regression where prestart
tasks that complete are causing the allocation to be marked unhealthy. This
changeset restores the previous behavior for prestart tasks.
This commit is contained in:
Tim Gross 2021-01-13 08:21:22 -05:00
parent 96fee70748
commit d55e3e2018

View file

@ -285,7 +285,7 @@ func (t *Tracker) watchTaskEvents() {
}
// One of the tasks has failed so we can exit watching
if state.Failed || !state.FinishedAt.IsZero() {
if state.Failed || (!state.FinishedAt.IsZero() && t.lifecycleTasks[taskName] != structs.TaskLifecycleHookPrestart) {
t.setTaskHealth(false, true)
return
}