tr: fix setting done in existing hooks

This commit is contained in:
Michael Schurter 2018-07-11 15:34:31 -07:00
parent b360f6f96e
commit 3a4f387fd3
1 changed files with 4 additions and 1 deletions

View File

@ -50,6 +50,7 @@ func (tr *TaskRunner) prerun() error {
for _, hook := range tr.runnerHooks { for _, hook := range tr.runnerHooks {
pre, ok := hook.(interfaces.TaskPrerunHook) pre, ok := hook.(interfaces.TaskPrerunHook)
if !ok { if !ok {
tr.logger.Trace("skipping: not a prerun hook", "name", hook.Name())
continue continue
} }
@ -63,7 +64,7 @@ func (tr *TaskRunner) prerun() error {
origHookState := tr.localState.Hooks[name] origHookState := tr.localState.Hooks[name]
if origHookState != nil && origHookState.PrerunDone { if origHookState != nil && origHookState.PrerunDone {
// Hook already ran, skip tr.logger.Trace("skipping: prerun hook already done", "name", pre.Name())
continue continue
} }
@ -229,6 +230,7 @@ func (h *taskDirHook) Prerun(req *interfaces.TaskPrerunRequest, resp *interfaces
// Update the environment variables based on the built task directory // Update the environment variables based on the built task directory
driver.SetEnvvars(h.runner.envBuilder, fsi, h.runner.taskDir, h.runner.clientConfig) driver.SetEnvvars(h.runner.envBuilder, fsi, h.runner.taskDir, h.runner.clientConfig)
resp.Done = true
return nil return nil
} }
@ -267,6 +269,7 @@ func (h *artifactHook) Prerun(req *interfaces.TaskPrerunRequest, resp *interface
} }
} }
resp.Done = true
return nil return nil
} }