Merge pull request #955 from github/delete-results-directory

Delete the results directory in between runs.
This commit is contained in:
Chris Gavin
2022-02-28 20:26:51 +00:00
committed by GitHub
4 changed files with 29 additions and 3 deletions
+1
View File
@@ -3,6 +3,7 @@
## [UNRELEASED]
- Update default CodeQL bundle version to 2.8.2.
- Fix a bug where old results can be uploaded if the languages in a repository change when using a non-ephemeral self-hosted runner.
## 1.1.3 - 23 Feb 2022
+14 -1
View File
@@ -242,7 +242,20 @@ async function runFinalize(outputDir, threadsFlag, memoryFlag, config, logger) {
// Delete the tracer config env var to avoid tracing ourselves
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
}
fs.mkdirSync(outputDir, { recursive: true });
// After switching to Node16, this entire block can be replaced with `await fs.promises.rm(outputDir, { recursive: true, force: true });`.
try {
await fs.promises.rmdir(outputDir, {
recursive: true,
maxRetries: 5,
retryDelay: 2000,
});
}
catch (error) {
if ((error === null || error === void 0 ? void 0 : error.code) !== "ENOENT") {
throw error;
}
}
await fs.promises.mkdir(outputDir, { recursive: true });
await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger);
}
exports.runFinalize = runFinalize;
+1 -1
View File
File diff suppressed because one or more lines are too long
+13 -1
View File
@@ -423,7 +423,19 @@ export async function runFinalize(
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
}
fs.mkdirSync(outputDir, { recursive: true });
// After switching to Node16, this entire block can be replaced with `await fs.promises.rm(outputDir, { recursive: true, force: true });`.
try {
await fs.promises.rmdir(outputDir, {
recursive: true,
maxRetries: 5,
retryDelay: 2000,
} as any);
} catch (error: any) {
if (error?.code !== "ENOENT") {
throw error;
}
}
await fs.promises.mkdir(outputDir, { recursive: true });
await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger);
}