Zip partial database directory

This commit is contained in:
Angela P Wen 2022-08-01 11:24:34 +02:00
parent 2746051310
commit 2c25894c5f
30 changed files with 3552 additions and 3 deletions

View file

@ -18,11 +18,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.uploadDatabaseBundleDebugArtifact = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const adm_zip_1 = __importDefault(require("adm-zip"));
const del_1 = __importDefault(require("del"));
const actionsUtil = __importStar(require("./actions-util"));
const analyze_1 = require("./analyze");
const codeql_1 = require("./codeql");
@ -46,7 +51,17 @@ async function uploadDatabaseBundleDebugArtifact(config, logger) {
for (const language of config.languages) {
if (!(0, analyze_1.dbIsFinalized)(config, language, logger)) {
core.info(`${config.debugDatabaseName}-${language} is not finalized. Uploading partial database bundle...`);
// TODO(angelapwen): Zip up files and upload directly.
// Zip up files and upload directly.
const databasePath = (0, util_1.getCodeQLDatabasePath)(config, language);
const databaseBundlePath = path.resolve(config.dbLocation, `${config.debugDatabaseName}.zip`);
// See `bundleDb` for explanation behind deleting existing db bundle.
if (fs.existsSync(databaseBundlePath)) {
await (0, del_1.default)(databaseBundlePath, { force: true });
}
const zip = new adm_zip_1.default();
zip.addLocalFolder(databasePath);
zip.writeZip(databaseBundlePath);
await actionsUtil.uploadDebugArtifacts([databaseBundlePath], config.dbLocation, config.debugArtifactName);
continue;
}
try {