From 9d8a7dd635b83cea8041d20578366f4d76a2e175 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Mon, 27 Feb 2023 10:08:18 -0500 Subject: [PATCH] populate Nomad token for task runner update hooks The `TaskUpdateRequest` struct we send to task runner update hooks was not populating the Nomad token that we get from the task runner (which we do for the Vault token). This results in task runner hooks like the template hook overwriting the Nomad token with the zero value for the token. This causes in-place updates of a task to break templates (but not other uses that rely on identity but don't currently bother to update it, like the identity hook). --- .changelog/16266.txt | 3 +++ client/allocrunner/taskrunner/task_runner_hooks.go | 1 + 2 files changed, 4 insertions(+) create mode 100644 .changelog/16266.txt diff --git a/.changelog/16266.txt b/.changelog/16266.txt new file mode 100644 index 000000000000..af9ffd1d4873 --- /dev/null +++ b/.changelog/16266.txt @@ -0,0 +1,3 @@ +```release-note:bug +template: Fixed a bug where the template runner's Nomad token would be erased by in-place updates to a task +``` diff --git a/client/allocrunner/taskrunner/task_runner_hooks.go b/client/allocrunner/taskrunner/task_runner_hooks.go index 7ea501982884..40ea084ba1a9 100644 --- a/client/allocrunner/taskrunner/task_runner_hooks.go +++ b/client/allocrunner/taskrunner/task_runner_hooks.go @@ -487,6 +487,7 @@ func (tr *TaskRunner) updateHooks() { // Build the request req := interfaces.TaskUpdateRequest{ + NomadToken: tr.getNomadToken(), VaultToken: tr.getVaultToken(), Alloc: alloc, TaskEnv: tr.envBuilder.Build(),