Add an option to upload some debugging artifacts

This commit is contained in:
Edoardo Pirovano 2021-10-28 14:15:22 +01:00
parent 4293754ed2
commit bc31f604d3
No known key found for this signature in database
GPG key ID: 047556B5D93FFE28
40 changed files with 374 additions and 65 deletions

View file

@ -18,6 +18,11 @@ import { Logger } from "./logging";
*/
export const GITHUB_DOTCOM_URL = "https://github.com";
/**
* Name of the debugging artifact.
*/
export const DEBUG_ARTIFACT_NAME = "debug-artifacts";
/**
* Get the extra options for the codeql commands.
*/
@ -542,3 +547,20 @@ export async function codeQlVersionAbove(
): Promise<boolean> {
return semver.gte(await codeql.getVersion(), requiredVersion);
}
// Create a bundle for the given DB, if it doesn't already exist
export async function bundleDb(
config: Config,
language: Language,
codeql: CodeQL
) {
const databasePath = getCodeQLDatabasePath(config, language);
const databaseBundlePath = path.resolve(
config.dbLocation,
`${databasePath}.zip`
);
if (!fs.existsSync(databaseBundlePath)) {
await codeql.databaseBundle(databasePath, databaseBundlePath);
}
return databaseBundlePath;
}