diff --git a/src/container-service.ts b/src/container-service.ts index 9984e93..9432ff3 100644 --- a/src/container-service.ts +++ b/src/container-service.ts @@ -45,7 +45,7 @@ export const ContainerService = { await container.start() await container.wait() } finally { - await container.remove() + await container.remove({v: true}) core.info(`Cleaned up container ${container.id}`) } } diff --git a/src/updater.ts b/src/updater.ts index ec40007..03f7f2a 100644 --- a/src/updater.ts +++ b/src/updater.ts @@ -53,8 +53,7 @@ export class Updater { // TODO: report job runner_error? core.error(`Error ${e}`) } finally { - await proxy.shutdown() - await this.docker.pruneNetworks() + await this.cleanup(proxy) } } catch (e) { // TODO: report job runner_error? @@ -165,4 +164,20 @@ export class Updater { core.info(`Created ${updaterCommand} container: ${container.id}`) return container } + + private async cleanup(proxy: Proxy): Promise { + await proxy.shutdown() + await this.docker.pruneNetworks() + + const outputDir = path.join(__dirname, '../output') + const repoDir = path.join(__dirname, '../repo') + + if (fs.existsSync(outputDir)) { + fs.rmdirSync(outputDir, {recursive: true}) + } + + if (fs.existsSync(repoDir)) { + fs.rmdirSync(repoDir, {recursive: true}) + } + } }