scaffolder-backend: remove workspace after task execution is complete

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-02-23 22:53:24 +01:00
committed by Johan Haals
parent 0f64c73474
commit b90767926f
@@ -44,10 +44,11 @@ export class TaskWorker {
}
async runOneTask(task: Task) {
let workspacePath: string | undefined = undefined;
try {
const { actionRegistry } = this.options;
const workspacePath = path.join(
workspacePath = path.join(
this.options.workingDirectory,
await task.getWorkspaceName(),
);
@@ -172,6 +173,10 @@ export class TaskWorker {
await task.complete('failed', {
error: { name: error.name, message: error.message },
});
} finally {
if (workspacePath) {
await fs.remove(workspacePath);
}
}
}
}