Merge branch 'main' into local-bundle
This commit is contained in:
commit
d9050f49a3
12 changed files with 186 additions and 66 deletions
54
.github/workflows/pr-checks.yml
vendored
54
.github/workflows/pr-checks.yml
vendored
|
|
@ -122,7 +122,6 @@ jobs:
|
||||||
languages: javascript
|
languages: javascript
|
||||||
# TODO: this can be removed when cli v2.5.6 is released and available in the tool cache
|
# TODO: this can be removed when cli v2.5.6 is released and available in the tool cache
|
||||||
tools: https://github.com/dsp-testing/aeisenberg-codeql-action-packaging/releases/download/codeql-bundle-20210615/codeql-bundle-linux64.tar.gz
|
tools: https://github.com/dsp-testing/aeisenberg-codeql-action-packaging/releases/download/codeql-bundle-20210615/codeql-bundle-linux64.tar.gz
|
||||||
|
|
||||||
- name: Build code
|
- name: Build code
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
|
|
@ -235,6 +234,59 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Tests a split workflow where database construction and query execution happen in different steps
|
||||||
|
test-split-workflow:
|
||||||
|
needs: [check-js, check-node-modules]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Move codeql-action
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir ../action
|
||||||
|
mv * .github ../action/
|
||||||
|
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||||
|
mv ../action/.github/workflows .github
|
||||||
|
- uses: ./../action/init
|
||||||
|
with:
|
||||||
|
config-file: ".github/codeql/codeql-config-packaging3.yml"
|
||||||
|
packs: +dsp-testing/codeql-pack1@0.0.4
|
||||||
|
languages: javascript
|
||||||
|
tools: latest
|
||||||
|
- name: Build code
|
||||||
|
shell: bash
|
||||||
|
run: ./build.sh
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
skip-queries: true
|
||||||
|
output: "${{ runner.temp }}/results"
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
- name: Assert No Results
|
||||||
|
run: |
|
||||||
|
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
|
||||||
|
echo "Expected results directory to be empty after skipping query execution!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
with:
|
||||||
|
output: "${{ runner.temp }}/results"
|
||||||
|
env:
|
||||||
|
TEST_MODE: true
|
||||||
|
- name: Assert Results
|
||||||
|
run: |
|
||||||
|
cd "$RUNNER_TEMP/results"
|
||||||
|
# We should have 3 hits from these rules
|
||||||
|
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||||
|
|
||||||
|
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||||
|
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||||
|
echo "Found matching rules '$RULES'"
|
||||||
|
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||||
|
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Identify the CodeQL tool versions to integration test against.
|
# Identify the CodeQL tool versions to integration test against.
|
||||||
check-codeql-versions:
|
check-codeql-versions:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## [UNRELEASED]
|
## [UNRELEASED]
|
||||||
|
|
||||||
No user facing changes.
|
- The `analyze` step of the Action now supports a `skip-queries` option to merely build the CodeQL database without analyzing. This functionality is not present in the runner. Additionally, the step will no longer fail if it encounters a finalized database, and will instead continue with query execution. [#602](https://github.com/github/codeql-action/pull/602)
|
||||||
|
|
||||||
## 1.0.4 - 28 Jun 2021
|
## 1.0.4 - 28 Jun 2021
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@ inputs:
|
||||||
description: Specify whether or not to add code snippets to the output sarif file.
|
description: Specify whether or not to add code snippets to the output sarif file.
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
skip-queries:
|
||||||
|
description: If this option is set, the CodeQL database will be built but no queries will be run on it. Thus, no results will be produced.
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
threads:
|
threads:
|
||||||
description: The number of threads to be used by CodeQL.
|
description: The number of threads to be used by CodeQL.
|
||||||
required: false
|
required: false
|
||||||
|
|
|
||||||
32
lib/analyze-action.js
generated
32
lib/analyze-action.js
generated
|
|
@ -34,7 +34,8 @@ async function sendStatusReport(startedAt, stats, error) {
|
||||||
}
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
let stats = undefined;
|
let uploadStats = undefined;
|
||||||
|
let runStats = undefined;
|
||||||
let config = undefined;
|
let config = undefined;
|
||||||
util.initializeEnvironment(util.Mode.actions, pkg.version);
|
util.initializeEnvironment(util.Mode.actions, pkg.version);
|
||||||
try {
|
try {
|
||||||
|
|
@ -51,7 +52,11 @@ async function run() {
|
||||||
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
};
|
};
|
||||||
const outputDir = actionsUtil.getRequiredInput("output");
|
const outputDir = actionsUtil.getRequiredInput("output");
|
||||||
const queriesStats = await analyze_1.runAnalyze(outputDir, util.getMemoryFlag(actionsUtil.getOptionalInput("ram")), util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger), actionsUtil.getOptionalInput("category"), config, logger);
|
const threads = util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger);
|
||||||
|
await analyze_1.runFinalize(outputDir, threads, config, logger);
|
||||||
|
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||||
|
runStats = await analyze_1.runQueries(outputDir, util.getMemoryFlag(actionsUtil.getOptionalInput("ram")), util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);
|
||||||
|
}
|
||||||
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
||||||
await analyze_1.runCleanup(config, actionsUtil.getOptionalInput("cleanup-level") || "brutal", logger);
|
await analyze_1.runCleanup(config, actionsUtil.getOptionalInput("cleanup-level") || "brutal", logger);
|
||||||
}
|
}
|
||||||
|
|
@ -60,13 +65,11 @@ async function run() {
|
||||||
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
dbLocations[language] = util.getCodeQLDatabasePath(config, language);
|
||||||
}
|
}
|
||||||
core.setOutput("db-locations", dbLocations);
|
core.setOutput("db-locations", dbLocations);
|
||||||
if (actionsUtil.getRequiredInput("upload") === "true") {
|
if (runStats && actionsUtil.getRequiredInput("upload") === "true") {
|
||||||
const uploadStats = await upload_lib.uploadFromActions(outputDir, config.gitHubVersion, apiDetails, logger);
|
uploadStats = await upload_lib.uploadFromActions(outputDir, config.gitHubVersion, apiDetails, logger);
|
||||||
stats = { ...queriesStats, ...uploadStats };
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger.info("Not uploading results");
|
logger.info("Not uploading results");
|
||||||
stats = { ...queriesStats };
|
|
||||||
}
|
}
|
||||||
const repositoryNwo = repository_1.parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
const repositoryNwo = repository_1.parseRepositoryNwo(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
||||||
await database_upload_1.uploadDatabases(repositoryNwo, config, apiDetails, logger);
|
await database_upload_1.uploadDatabases(repositoryNwo, config, apiDetails, logger);
|
||||||
|
|
@ -75,9 +78,12 @@ async function run() {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
console.log(error);
|
console.log(error);
|
||||||
if (error instanceof analyze_1.CodeQLAnalysisError) {
|
if (error instanceof analyze_1.CodeQLAnalysisError) {
|
||||||
stats = { ...error.queriesStatusReport };
|
const stats = { ...error.queriesStatusReport };
|
||||||
|
await sendStatusReport(startedAt, stats, error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await sendStatusReport(startedAt, undefined, error);
|
||||||
}
|
}
|
||||||
await sendStatusReport(startedAt, stats, error);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
@ -103,7 +109,15 @@ async function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await sendStatusReport(startedAt, stats);
|
if (runStats && uploadStats) {
|
||||||
|
await sendStatusReport(startedAt, { ...runStats, ...uploadStats });
|
||||||
|
}
|
||||||
|
else if (runStats) {
|
||||||
|
await sendStatusReport(startedAt, { ...runStats });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await sendStatusReport(startedAt, undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"analyze-action.js","sourceRoot":"","sources":["../src/analyze-action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,oDAAsC;AAEtC,4DAA8C;AAC9C,uCAKmB;AACnB,iDAAmD;AACnD,uDAAoD;AACpD,uCAA6C;AAC7C,6CAAkD;AAClD,yDAA2C;AAC3C,6CAA+B;AAE/B,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAUvC,KAAK,UAAU,gBAAgB,CAC7B,SAAe,EACf,KAAuC,EACvC,KAAa;;IAEb,MAAM,MAAM,GACV,OAAA,KAAK,0CAAE,wBAAwB,MAAK,SAAS,IAAI,KAAK,KAAK,SAAS;QAClE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,gBAAgB,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AAI,CAAC,QAAQ,EAAE,CAAC;yBACjB;6BAAM,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE;4BAC9B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;yBAC7C;qBACF;gBACH,CAAC,CAAC;gBACF,YAAY,CAAC,aAAa,CAAC,CAAC;aAC7B;SACF;KACF;IAED,IAAI,QAAQ,IAAI,WAAW,EAAE;QAC3B,MAAM,gBAAgB,CAAC,SAAS,EAAE,EAAE,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;KACpE;SAAM,IAAI,QAAQ,EAAE;QACnB,MAAM,gBAAgB,CAAC,SAAS,EAAE,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;KACpD;SAAM;QACL,MAAM,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;KAC9C;AACH,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
32
lib/analyze.js
generated
32
lib/analyze.js
generated
|
|
@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||||
|
const yaml = __importStar(require("js-yaml"));
|
||||||
const analysisPaths = __importStar(require("./analysis-paths"));
|
const analysisPaths = __importStar(require("./analysis-paths"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const count_loc_1 = require("./count-loc");
|
const count_loc_1 = require("./count-loc");
|
||||||
|
|
@ -55,7 +56,8 @@ async function createdDBForScannedLanguages(config, logger) {
|
||||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
if (languages_1.isScannedLanguage(language)) {
|
if (languages_1.isScannedLanguage(language) &&
|
||||||
|
!dbIsFinalized(config, language, logger)) {
|
||||||
logger.startGroup(`Extracting ${language}`);
|
logger.startGroup(`Extracting ${language}`);
|
||||||
if (language === languages_1.Language.python) {
|
if (language === languages_1.Language.python) {
|
||||||
await setupPythonExtractor(logger);
|
await setupPythonExtractor(logger);
|
||||||
|
|
@ -65,13 +67,29 @@ async function createdDBForScannedLanguages(config, logger) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function dbIsFinalized(config, language, logger) {
|
||||||
|
const dbPath = util.getCodeQLDatabasePath(config, language);
|
||||||
|
try {
|
||||||
|
const dbInfo = yaml.load(fs.readFileSync(path.resolve(dbPath, "codeql-database.yml"), "utf8"));
|
||||||
|
return !("inProgress" in dbInfo);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
logger.warning(`Could not check whether database for ${language} was finalized. Assuming it is not.`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
async function finalizeDatabaseCreation(config, threadsFlag, logger) {
|
async function finalizeDatabaseCreation(config, threadsFlag, logger) {
|
||||||
await createdDBForScannedLanguages(config, logger);
|
await createdDBForScannedLanguages(config, logger);
|
||||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
logger.startGroup(`Finalizing ${language}`);
|
if (dbIsFinalized(config, language, logger)) {
|
||||||
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag);
|
logger.info(`There is already a finalized database for ${language} at the location where the CodeQL Action places databases, so we did not create one.`);
|
||||||
logger.endGroup();
|
}
|
||||||
|
else {
|
||||||
|
logger.startGroup(`Finalizing ${language}`);
|
||||||
|
await codeql.finalizeDatabase(util.getCodeQLDatabasePath(config, language), threadsFlag);
|
||||||
|
logger.endGroup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Runs queries and creates sarif files in the given folder
|
// Runs queries and creates sarif files in the given folder
|
||||||
|
|
@ -183,15 +201,13 @@ function packWithVersionToQuerySuiteEntry(pack) {
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
async function runAnalyze(outputDir, memoryFlag, addSnippetsFlag, threadsFlag, automationDetailsId, config, logger) {
|
async function runFinalize(outputDir, threadsFlag, config, logger) {
|
||||||
// Delete the tracer config env var to avoid tracing ourselves
|
// Delete the tracer config env var to avoid tracing ourselves
|
||||||
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
||||||
fs.mkdirSync(outputDir, { recursive: true });
|
fs.mkdirSync(outputDir, { recursive: true });
|
||||||
await finalizeDatabaseCreation(config, threadsFlag, logger);
|
await finalizeDatabaseCreation(config, threadsFlag, logger);
|
||||||
const queriesStats = await runQueries(outputDir, memoryFlag, addSnippetsFlag, threadsFlag, automationDetailsId, config, logger);
|
|
||||||
return { ...queriesStats };
|
|
||||||
}
|
}
|
||||||
exports.runAnalyze = runAnalyze;
|
exports.runFinalize = runFinalize;
|
||||||
async function runCleanup(config, cleanupLevel, logger) {
|
async function runCleanup(config, cleanupLevel, logger) {
|
||||||
logger.startGroup("Cleaning up databases");
|
logger.startGroup("Cleaning up databases");
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
4
lib/runner.js
generated
4
lib/runner.js
generated
|
|
@ -243,7 +243,9 @@ program
|
||||||
url: util_1.parseGitHubUrl(cmd.githubUrl),
|
url: util_1.parseGitHubUrl(cmd.githubUrl),
|
||||||
};
|
};
|
||||||
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
const outputDir = cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
||||||
await analyze_1.runAnalyze(outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), util_1.getThreadsFlag(cmd.threads, logger), cmd.category, config, logger);
|
const threads = util_1.getThreadsFlag(cmd.threads, logger);
|
||||||
|
await analyze_1.runFinalize(outputDir, threads, config, logger);
|
||||||
|
await analyze_1.runQueries(outputDir, util_1.getMemoryFlag(cmd.ram), util_1.getAddSnippetsFlag(cmd.addSnippets), threads, cmd.category, config, logger);
|
||||||
if (!cmd.upload) {
|
if (!cmd.upload) {
|
||||||
logger.info("Not uploading results");
|
logger.info("Not uploading results");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -5,16 +5,18 @@ import * as core from "@actions/core";
|
||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import {
|
import {
|
||||||
runAnalyze,
|
|
||||||
CodeQLAnalysisError,
|
CodeQLAnalysisError,
|
||||||
QueriesStatusReport,
|
QueriesStatusReport,
|
||||||
runCleanup,
|
runCleanup,
|
||||||
|
runQueries,
|
||||||
|
runFinalize,
|
||||||
} from "./analyze";
|
} from "./analyze";
|
||||||
import { Config, getConfig } from "./config-utils";
|
import { Config, getConfig } from "./config-utils";
|
||||||
import { uploadDatabases } from "./database-upload";
|
import { uploadDatabases } from "./database-upload";
|
||||||
import { getActionsLogger } from "./logging";
|
import { getActionsLogger } from "./logging";
|
||||||
import { parseRepositoryNwo } from "./repository";
|
import { parseRepositoryNwo } from "./repository";
|
||||||
import * as upload_lib from "./upload-lib";
|
import * as upload_lib from "./upload-lib";
|
||||||
|
import { UploadStatusReport } from "./upload-lib";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
|
|
@ -53,7 +55,8 @@ async function sendStatusReport(
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
let stats: AnalysisStatusReport | undefined = undefined;
|
let uploadStats: UploadStatusReport | undefined = undefined;
|
||||||
|
let runStats: QueriesStatusReport | undefined = undefined;
|
||||||
let config: Config | undefined = undefined;
|
let config: Config | undefined = undefined;
|
||||||
util.initializeEnvironment(util.Mode.actions, pkg.version);
|
util.initializeEnvironment(util.Mode.actions, pkg.version);
|
||||||
|
|
||||||
|
|
@ -82,15 +85,22 @@ async function run() {
|
||||||
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
url: util.getRequiredEnvParam("GITHUB_SERVER_URL"),
|
||||||
};
|
};
|
||||||
const outputDir = actionsUtil.getRequiredInput("output");
|
const outputDir = actionsUtil.getRequiredInput("output");
|
||||||
const queriesStats = await runAnalyze(
|
const threads = util.getThreadsFlag(
|
||||||
outputDir,
|
actionsUtil.getOptionalInput("threads"),
|
||||||
util.getMemoryFlag(actionsUtil.getOptionalInput("ram")),
|
|
||||||
util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")),
|
|
||||||
util.getThreadsFlag(actionsUtil.getOptionalInput("threads"), logger),
|
|
||||||
actionsUtil.getOptionalInput("category"),
|
|
||||||
config,
|
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
|
await runFinalize(outputDir, threads, config, logger);
|
||||||
|
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||||
|
runStats = await runQueries(
|
||||||
|
outputDir,
|
||||||
|
util.getMemoryFlag(actionsUtil.getOptionalInput("ram")),
|
||||||
|
util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")),
|
||||||
|
threads,
|
||||||
|
actionsUtil.getOptionalInput("category"),
|
||||||
|
config,
|
||||||
|
logger
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
||||||
await runCleanup(
|
await runCleanup(
|
||||||
|
|
@ -106,17 +116,15 @@ async function run() {
|
||||||
}
|
}
|
||||||
core.setOutput("db-locations", dbLocations);
|
core.setOutput("db-locations", dbLocations);
|
||||||
|
|
||||||
if (actionsUtil.getRequiredInput("upload") === "true") {
|
if (runStats && actionsUtil.getRequiredInput("upload") === "true") {
|
||||||
const uploadStats = await upload_lib.uploadFromActions(
|
uploadStats = await upload_lib.uploadFromActions(
|
||||||
outputDir,
|
outputDir,
|
||||||
config.gitHubVersion,
|
config.gitHubVersion,
|
||||||
apiDetails,
|
apiDetails,
|
||||||
logger
|
logger
|
||||||
);
|
);
|
||||||
stats = { ...queriesStats, ...uploadStats };
|
|
||||||
} else {
|
} else {
|
||||||
logger.info("Not uploading results");
|
logger.info("Not uploading results");
|
||||||
stats = { ...queriesStats };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const repositoryNwo = parseRepositoryNwo(
|
const repositoryNwo = parseRepositoryNwo(
|
||||||
|
|
@ -128,10 +136,12 @@ async function run() {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
||||||
if (error instanceof CodeQLAnalysisError) {
|
if (error instanceof CodeQLAnalysisError) {
|
||||||
stats = { ...error.queriesStatusReport };
|
const stats = { ...error.queriesStatusReport };
|
||||||
|
await sendStatusReport(startedAt, stats, error);
|
||||||
|
} else {
|
||||||
|
await sendStatusReport(startedAt, undefined, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
await sendStatusReport(startedAt, stats, error);
|
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
if (core.isDebug() && config !== undefined) {
|
if (core.isDebug() && config !== undefined) {
|
||||||
|
|
@ -161,7 +171,13 @@ async function run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await sendStatusReport(startedAt, stats);
|
if (runStats && uploadStats) {
|
||||||
|
await sendStatusReport(startedAt, { ...runStats, ...uploadStats });
|
||||||
|
} else if (runStats) {
|
||||||
|
await sendStatusReport(startedAt, { ...runStats });
|
||||||
|
} else {
|
||||||
|
await sendStatusReport(startedAt, undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
import * as toolrunner from "@actions/exec/lib/toolrunner";
|
||||||
|
import * as yaml from "js-yaml";
|
||||||
|
|
||||||
import * as analysisPaths from "./analysis-paths";
|
import * as analysisPaths from "./analysis-paths";
|
||||||
import { getCodeQL } from "./codeql";
|
import { getCodeQL } from "./codeql";
|
||||||
|
|
@ -117,7 +118,10 @@ async function createdDBForScannedLanguages(
|
||||||
|
|
||||||
const codeql = getCodeQL(config.codeQLCmd);
|
const codeql = getCodeQL(config.codeQLCmd);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
if (isScannedLanguage(language)) {
|
if (
|
||||||
|
isScannedLanguage(language) &&
|
||||||
|
!dbIsFinalized(config, language, logger)
|
||||||
|
) {
|
||||||
logger.startGroup(`Extracting ${language}`);
|
logger.startGroup(`Extracting ${language}`);
|
||||||
|
|
||||||
if (language === Language.python) {
|
if (language === Language.python) {
|
||||||
|
|
@ -133,6 +137,25 @@ async function createdDBForScannedLanguages(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dbIsFinalized(
|
||||||
|
config: configUtils.Config,
|
||||||
|
language: Language,
|
||||||
|
logger: Logger
|
||||||
|
) {
|
||||||
|
const dbPath = util.getCodeQLDatabasePath(config, language);
|
||||||
|
try {
|
||||||
|
const dbInfo = yaml.load(
|
||||||
|
fs.readFileSync(path.resolve(dbPath, "codeql-database.yml"), "utf8")
|
||||||
|
);
|
||||||
|
return !("inProgress" in dbInfo);
|
||||||
|
} catch (e) {
|
||||||
|
logger.warning(
|
||||||
|
`Could not check whether database for ${language} was finalized. Assuming it is not.`
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function finalizeDatabaseCreation(
|
async function finalizeDatabaseCreation(
|
||||||
config: configUtils.Config,
|
config: configUtils.Config,
|
||||||
threadsFlag: string,
|
threadsFlag: string,
|
||||||
|
|
@ -142,12 +165,18 @@ async function finalizeDatabaseCreation(
|
||||||
|
|
||||||
const codeql = getCodeQL(config.codeQLCmd);
|
const codeql = getCodeQL(config.codeQLCmd);
|
||||||
for (const language of config.languages) {
|
for (const language of config.languages) {
|
||||||
logger.startGroup(`Finalizing ${language}`);
|
if (dbIsFinalized(config, language, logger)) {
|
||||||
await codeql.finalizeDatabase(
|
logger.info(
|
||||||
util.getCodeQLDatabasePath(config, language),
|
`There is already a finalized database for ${language} at the location where the CodeQL Action places databases, so we did not create one.`
|
||||||
threadsFlag
|
);
|
||||||
);
|
} else {
|
||||||
logger.endGroup();
|
logger.startGroup(`Finalizing ${language}`);
|
||||||
|
await codeql.finalizeDatabase(
|
||||||
|
util.getCodeQLDatabasePath(config, language),
|
||||||
|
threadsFlag
|
||||||
|
);
|
||||||
|
logger.endGroup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,33 +378,18 @@ function packWithVersionToQuerySuiteEntry(
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runAnalyze(
|
export async function runFinalize(
|
||||||
outputDir: string,
|
outputDir: string,
|
||||||
memoryFlag: string,
|
|
||||||
addSnippetsFlag: string,
|
|
||||||
threadsFlag: string,
|
threadsFlag: string,
|
||||||
automationDetailsId: string | undefined,
|
|
||||||
config: configUtils.Config,
|
config: configUtils.Config,
|
||||||
logger: Logger
|
logger: Logger
|
||||||
): Promise<QueriesStatusReport> {
|
) {
|
||||||
// Delete the tracer config env var to avoid tracing ourselves
|
// Delete the tracer config env var to avoid tracing ourselves
|
||||||
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
|
||||||
|
|
||||||
fs.mkdirSync(outputDir, { recursive: true });
|
fs.mkdirSync(outputDir, { recursive: true });
|
||||||
|
|
||||||
await finalizeDatabaseCreation(config, threadsFlag, logger);
|
await finalizeDatabaseCreation(config, threadsFlag, logger);
|
||||||
|
|
||||||
const queriesStats = await runQueries(
|
|
||||||
outputDir,
|
|
||||||
memoryFlag,
|
|
||||||
addSnippetsFlag,
|
|
||||||
threadsFlag,
|
|
||||||
automationDetailsId,
|
|
||||||
config,
|
|
||||||
logger
|
|
||||||
);
|
|
||||||
|
|
||||||
return { ...queriesStats };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runCleanup(
|
export async function runCleanup(
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import * as path from "path";
|
||||||
|
|
||||||
import { Command } from "commander";
|
import { Command } from "commander";
|
||||||
|
|
||||||
import { runAnalyze } from "./analyze";
|
import { runFinalize, runQueries } from "./analyze";
|
||||||
import { determineAutobuildLanguage, runAutobuild } from "./autobuild";
|
import { determineAutobuildLanguage, runAutobuild } from "./autobuild";
|
||||||
import { CodeQL, getCodeQL } from "./codeql";
|
import { CodeQL, getCodeQL } from "./codeql";
|
||||||
import { Config, getConfig } from "./config-utils";
|
import { Config, getConfig } from "./config-utils";
|
||||||
|
|
@ -431,11 +431,13 @@ program
|
||||||
|
|
||||||
const outputDir =
|
const outputDir =
|
||||||
cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
cmd.outputDir || path.join(config.tempDir, "codeql-sarif");
|
||||||
await runAnalyze(
|
const threads = getThreadsFlag(cmd.threads, logger);
|
||||||
|
await runFinalize(outputDir, threads, config, logger);
|
||||||
|
await runQueries(
|
||||||
outputDir,
|
outputDir,
|
||||||
getMemoryFlag(cmd.ram),
|
getMemoryFlag(cmd.ram),
|
||||||
getAddSnippetsFlag(cmd.addSnippets),
|
getAddSnippetsFlag(cmd.addSnippets),
|
||||||
getThreadsFlag(cmd.threads, logger),
|
threads,
|
||||||
cmd.category,
|
cmd.category,
|
||||||
config,
|
config,
|
||||||
logger
|
logger
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue