Clean up DB cluster directory at the end of each job

This commit is contained in:
Henry Mercer 2024-06-12 14:51:03 +01:00
parent 3d849e9df2
commit d8d73c0e76
3 changed files with 28 additions and 1 deletions

View file

@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getFinalJobStatus = exports.run = exports.tryUploadSarifIfRunFailed = void 0;
const fs = __importStar(require("fs"));
const core = __importStar(require("@actions/core"));
const github = __importStar(require("@actions/github"));
const actionsUtil = __importStar(require("./actions-util"));
@ -134,6 +135,17 @@ async function run(uploadDatabaseBundleDebugArtifact, uploadLogsDebugArtifact, p
await uploadLogsDebugArtifact(config);
await printDebugLogs(config);
}
try {
fs.rmSync(config.dbLocation, {
recursive: true,
force: true,
maxRetries: 3,
});
logger.info(`Cleaned up database cluster directory ${config.dbLocation}.`);
}
catch (e) {
logger.warning(`Failed to clean up database cluster directory ${config.dbLocation}. Details: ${e}`);
}
return uploadFailedSarifResult;
}
exports.run = run;

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,5 @@
import * as fs from "fs";
import * as core from "@actions/core";
import * as github from "@actions/github";
@ -217,6 +219,19 @@ export async function run(
await printDebugLogs(config);
}
try {
fs.rmSync(config.dbLocation, {
recursive: true,
force: true,
maxRetries: 3,
});
logger.info(`Cleaned up database cluster directory ${config.dbLocation}.`);
} catch (e) {
logger.warning(
`Failed to clean up database cluster directory ${config.dbLocation}. Details: ${e}`,
);
}
return uploadFailedSarifResult;
}