diff --git a/.changelog/18662.txt b/.changelog/18662.txt new file mode 100644 index 000000000..6621656b0 --- /dev/null +++ b/.changelog/18662.txt @@ -0,0 +1,3 @@ +```release-note:bug +client: prevent tasks from starting without the prestart hooks running +``` diff --git a/client/allocrunner/taskrunner/task_runner.go b/client/allocrunner/taskrunner/task_runner.go index 9cf953c03..174760188 100644 --- a/client/allocrunner/taskrunner/task_runner.go +++ b/client/allocrunner/taskrunner/task_runner.go @@ -599,6 +599,12 @@ MAIN: goto RESTART } + // Check for a terminal allocation once more before proceeding as the + // prestart hooks may have been skipped. + if tr.shouldShutdown() { + break MAIN + } + select { case <-tr.killCtx.Done(): break MAIN