mirror of
https://github.com/github/codeql-action.git
synced 2026-04-02 17:52:19 +00:00
Include base database OIDs when bundling database
This commit is contained in:
17
lib/analyze-action-post.js
generated
17
lib/analyze-action-post.js
generated
@@ -126165,6 +126165,7 @@ var maximumVersion = "3.20";
|
||||
var minimumVersion = "3.14";
|
||||
|
||||
// src/util.ts
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
function getExtraOptionsEnvParam() {
|
||||
@@ -126271,6 +126272,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
}
|
||||
@@ -126933,9 +126937,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path2.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -127601,7 +127602,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -127610,6 +127611,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
21
lib/analyze-action.js
generated
21
lib/analyze-action.js
generated
@@ -92764,6 +92764,7 @@ var safeDump = renamed("safeDump", "dump");
|
||||
|
||||
// src/util.ts
|
||||
var semver = __toESM(require_semver2());
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var DEFAULT_RESERVED_RAM_SCALING_FACTOR = 0.05;
|
||||
@@ -93084,13 +93085,18 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function bundleDb(config, language, codeql, dbName) {
|
||||
const databasePath = getCodeQLDatabasePath(config, language);
|
||||
const databaseBundlePath = path.resolve(config.dbLocation, `${dbName}.zip`);
|
||||
if (fs.existsSync(databaseBundlePath)) {
|
||||
await fs.promises.rm(databaseBundlePath, { force: true });
|
||||
}
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName, [
|
||||
BASE_DATABASE_OIDS_FILE_NAME
|
||||
]);
|
||||
return databaseBundlePath;
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
@@ -94305,9 +94311,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path4.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -96644,7 +96647,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -96653,6 +96656,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
17
lib/autobuild-action.js
generated
17
lib/autobuild-action.js
generated
@@ -89863,6 +89863,7 @@ var maximumVersion = "3.20";
|
||||
var minimumVersion = "3.14";
|
||||
|
||||
// src/util.ts
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
function getExtraOptionsEnvParam() {
|
||||
@@ -89994,6 +89995,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
function isInTestMode() {
|
||||
return process.env["CODEQL_ACTION_TEST_MODE" /* TEST_MODE */] === "true";
|
||||
}
|
||||
@@ -90792,9 +90796,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path2.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -91762,7 +91763,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -91771,6 +91772,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
21
lib/init-action-post.js
generated
21
lib/init-action-post.js
generated
@@ -129063,6 +129063,7 @@ var maximumVersion = "3.20";
|
||||
var minimumVersion = "3.14";
|
||||
|
||||
// src/util.ts
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
@@ -129208,13 +129209,18 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function bundleDb(config, language, codeql, dbName) {
|
||||
const databasePath = getCodeQLDatabasePath(config, language);
|
||||
const databaseBundlePath = path.resolve(config.dbLocation, `${dbName}.zip`);
|
||||
if (fs.existsSync(databaseBundlePath)) {
|
||||
await fs.promises.rm(databaseBundlePath, { force: true });
|
||||
}
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName, [
|
||||
BASE_DATABASE_OIDS_FILE_NAME
|
||||
]);
|
||||
return databaseBundlePath;
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
@@ -130308,9 +130314,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path3.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -132219,7 +132222,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -132228,6 +132231,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
17
lib/init-action.js
generated
17
lib/init-action.js
generated
@@ -90081,6 +90081,7 @@ var maximumVersion = "3.20";
|
||||
var minimumVersion = "3.14";
|
||||
|
||||
// src/util.ts
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var DEFAULT_DEBUG_ARTIFACT_NAME = "debug-artifacts";
|
||||
@@ -90411,6 +90412,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
const { allowProcessExit } = opts || {};
|
||||
return new Promise((resolve9) => {
|
||||
@@ -91766,9 +91770,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path5.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -94926,7 +94927,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -94935,6 +94936,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
17
lib/resolve-environment-action.js
generated
17
lib/resolve-environment-action.js
generated
@@ -89863,6 +89863,7 @@ var maximumVersion = "3.20";
|
||||
var minimumVersion = "3.14";
|
||||
|
||||
// src/util.ts
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
function getExtraOptionsEnvParam() {
|
||||
@@ -89987,6 +89988,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
const { allowProcessExit } = opts || {};
|
||||
return new Promise((resolve4) => {
|
||||
@@ -90785,9 +90789,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path2.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -91455,7 +91456,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -91464,6 +91465,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
17
lib/setup-codeql-action.js
generated
17
lib/setup-codeql-action.js
generated
@@ -89919,6 +89919,7 @@ var maximumVersion = "3.20";
|
||||
var minimumVersion = "3.14";
|
||||
|
||||
// src/util.ts
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
@@ -90060,6 +90061,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
const { allowProcessExit } = opts || {};
|
||||
return new Promise((resolve4) => {
|
||||
@@ -90694,9 +90698,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path3.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -92764,7 +92765,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -92773,6 +92774,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
17
lib/upload-lib.js
generated
17
lib/upload-lib.js
generated
@@ -92781,6 +92781,7 @@ var safeDump = renamed("safeDump", "dump");
|
||||
|
||||
// src/util.ts
|
||||
var semver = __toESM(require_semver2());
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
@@ -92900,6 +92901,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
const { allowProcessExit } = opts || {};
|
||||
return new Promise((resolve6) => {
|
||||
@@ -93849,9 +93853,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path3.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -95480,7 +95481,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -95489,6 +95490,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
17
lib/upload-sarif-action.js
generated
17
lib/upload-sarif-action.js
generated
@@ -92755,6 +92755,7 @@ var safeDump = renamed("safeDump", "dump");
|
||||
|
||||
// src/util.ts
|
||||
var semver = __toESM(require_semver2());
|
||||
var BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
var BROKEN_VERSIONS = ["0.0.0-20211207"];
|
||||
var GITHUB_DOTCOM_URL = "https://github.com";
|
||||
var MINIMUM_CGROUP_MEMORY_LIMIT_BYTES = 1024 * 1024;
|
||||
@@ -92881,6 +92882,9 @@ function getCachedCodeQlVersion() {
|
||||
async function codeQlVersionAtLeast(codeql, requiredVersion) {
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
async function delay(milliseconds, opts) {
|
||||
const { allowProcessExit } = opts || {};
|
||||
return new Promise((resolve6) => {
|
||||
@@ -93644,9 +93648,6 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path3.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
const overlayFileOids = await getFileOidsUnderPath(sourceRoot);
|
||||
@@ -96004,7 +96005,7 @@ ${output}`
|
||||
await runCli(cmd, codeqlArgs);
|
||||
}
|
||||
},
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName) {
|
||||
async databaseBundle(databasePath, outputFilePath, databaseName, tryAlsoIncludeRelativePaths) {
|
||||
const args = [
|
||||
"database",
|
||||
"bundle",
|
||||
@@ -96013,6 +96014,14 @@ ${output}`
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"])
|
||||
];
|
||||
if (await this.supportsFeature("bundleSupportsIncludeOption" /* BundleSupportsIncludeOption */)) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath
|
||||
])
|
||||
);
|
||||
}
|
||||
await new toolrunner3.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(databasePath, sarifFile, automationDetailsId) {
|
||||
|
||||
@@ -147,11 +147,19 @@ export interface CodeQL {
|
||||
): Promise<void>;
|
||||
/**
|
||||
* Run 'codeql database bundle'.
|
||||
*
|
||||
* @param tryAlsoIncludeRelativePaths Additional paths that should be included in the bundle if possible.
|
||||
*
|
||||
* These paths are relative to the database root.
|
||||
*
|
||||
* Older versions of the CodeQL CLI do not support including additional paths in the bundle.
|
||||
* In those cases, this parameter will be ignored.
|
||||
*/
|
||||
databaseBundle(
|
||||
databasePath: string,
|
||||
outputFilePath: string,
|
||||
dbName: string,
|
||||
tryAlsoIncludeRelativePaths: string[],
|
||||
): Promise<void>;
|
||||
/**
|
||||
* Run 'codeql database run-queries'. If no `queries` are specified, then the CLI
|
||||
@@ -911,6 +919,7 @@ async function getCodeQLForCmd(
|
||||
databasePath: string,
|
||||
outputFilePath: string,
|
||||
databaseName: string,
|
||||
tryAlsoIncludeRelativePaths: string[],
|
||||
): Promise<void> {
|
||||
const args = [
|
||||
"database",
|
||||
@@ -920,6 +929,16 @@ async function getCodeQLForCmd(
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"]),
|
||||
];
|
||||
if (
|
||||
await this.supportsFeature(ToolsFeature.BundleSupportsIncludeOption)
|
||||
) {
|
||||
args.push(
|
||||
...tryAlsoIncludeRelativePaths.flatMap((relativePath) => [
|
||||
"--include",
|
||||
relativePath,
|
||||
]),
|
||||
);
|
||||
}
|
||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
async databaseExportDiagnostics(
|
||||
|
||||
@@ -17,6 +17,7 @@ import { getCommitOid, getFileOidsUnderPath } from "./git-utils";
|
||||
import { Logger, withGroupAsync } from "./logging";
|
||||
import {
|
||||
CleanupLevel,
|
||||
getBaseDatabaseOidsFilePath,
|
||||
getCodeQLDatabasePath,
|
||||
getErrorMessage,
|
||||
isInTestMode,
|
||||
@@ -98,10 +99,6 @@ async function readBaseDatabaseOidsFile(
|
||||
}
|
||||
}
|
||||
|
||||
function getBaseDatabaseOidsFilePath(config: Config): string {
|
||||
return path.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a JSON file containing the source-root-relative paths of files under
|
||||
* `sourceRoot` that have changed (added, removed, or modified) from the overlay
|
||||
|
||||
14
src/util.ts
14
src/util.ts
@@ -16,6 +16,12 @@ import { EnvVar } from "./environment";
|
||||
import { Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
|
||||
/**
|
||||
* The name of the file containing the base database OIDs, as stored in the
|
||||
* root of the database location.
|
||||
*/
|
||||
const BASE_DATABASE_OIDS_FILE_NAME = "base-database-oids.json";
|
||||
|
||||
/**
|
||||
* Specifies bundle versions that are known to be broken
|
||||
* and will not be used if found in the toolcache.
|
||||
@@ -728,6 +734,10 @@ export async function codeQlVersionAtLeast(
|
||||
return semver.gte((await codeql.getVersion()).version, requiredVersion);
|
||||
}
|
||||
|
||||
export function getBaseDatabaseOidsFilePath(config: Config): string {
|
||||
return path.join(config.dbLocation, BASE_DATABASE_OIDS_FILE_NAME);
|
||||
}
|
||||
|
||||
// Create a bundle for the given DB, if it doesn't already exist
|
||||
export async function bundleDb(
|
||||
config: Config,
|
||||
@@ -745,7 +755,9 @@ export async function bundleDb(
|
||||
if (fs.existsSync(databaseBundlePath)) {
|
||||
await fs.promises.rm(databaseBundlePath, { force: true });
|
||||
}
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName, [
|
||||
BASE_DATABASE_OIDS_FILE_NAME,
|
||||
]);
|
||||
return databaseBundlePath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user