From e1d49f260865e22c62a3151c225aa3940960ba3f Mon Sep 17 00:00:00 2001 From: Thorarinn Sigurdsson Date: Tue, 9 Jul 2019 16:57:27 +0200 Subject: [PATCH] fix: emit taskComplete when adding cached tasks This clears the error and cancelled node states on the dashboard's stack graph tab e.g. when reverting the underlying code to a functioning/correct version that had previously been built/deployed/tested during the execution of the current command. --- garden-service/src/task-graph.ts | 5 +++++ garden-service/test/unit/src/task-graph.ts | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/garden-service/src/task-graph.ts b/garden-service/src/task-graph.ts index 569ea614ee..925237e2fd 100644 --- a/garden-service/src/task-graph.ts +++ b/garden-service/src/task-graph.ts @@ -119,6 +119,11 @@ export class TaskGraph { key: task.getKey(), version: task.version, }) + } else { + const result = this.resultCache.get(task.getKey(), task.version.versionString) + if (result) { + this.garden.events.emit("taskComplete", result) + } } } diff --git a/garden-service/test/unit/src/task-graph.ts b/garden-service/test/unit/src/task-graph.ts index eeaf45832e..92e6235afc 100644 --- a/garden-service/test/unit/src/task-graph.ts +++ b/garden-service/test/unit/src/task-graph.ts @@ -19,12 +19,6 @@ interface TestTaskOptions { throwError?: boolean } -const testTaskVersion = { - versionString: "12345-6789", - dependencyVersions: {}, - files: [], -} - class TestTask extends BaseTask { type: TaskType = "test" name: string @@ -159,6 +153,13 @@ describe("task-graph", () => { await graph.process([repeatedTask]) expect(garden.events.eventLog).to.eql([ + { + name: "taskComplete", + payload: { + dependencyResults: {}, description: "a", key: task.getKey(), type: "test", name: "a", + output: { dependencyResults: {}, result: "result-a" }, + }, + }, { name: "taskGraphProcessing", payload: { startedAt: now } }, { name: "taskGraphComplete", payload: { completedAt: now } }, ])