From d55e3e201845f93637b8919bae08cc5485553c93 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 13 Jan 2021 08:21:22 -0500 Subject: [PATCH] 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. --- client/allochealth/tracker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/allochealth/tracker.go b/client/allochealth/tracker.go index c61f25664..f50640ddb 100644 --- a/client/allochealth/tracker.go +++ b/client/allochealth/tracker.go @@ -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 }