Skip to content

Commit

Permalink
Merge branch 'main' into henrymercer/revert-node-16-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Feb 17, 2022
2 parents 070bf9a + cefec5b commit 72f407c
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 56 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## [UNRELEASED]

- Due to potential issues for GHES 3.1–3.3 customers who are using recent versions of the CodeQL Action via GHES Connect, the CodeQL Action now uses Node.js v12 rather than Node.js v16. [#937](https://github.com/github/codeql-action/pull/937)

## 1.1.1 - 17 Feb 2022

- The CodeQL CLI versions up to and including version 2.4.4 are not compatible with the CodeQL Action 1.1.1 and later. The Action will emit an error if it detects that it is being used by an incompatible version of the CLI. [#931](https://github.com/github/codeql-action/pull/931)
- Update default CodeQL bundle version to 2.8.1. [#925](https://github.com/github/codeql-action/pull/925)

Expand Down
27 changes: 6 additions & 21 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/init.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeql",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"description": "CodeQL action",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion runner/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeql-runner",
"version": "1.0.34",
"version": "1.0.35",
"private": true,
"description": "CodeQL runner",
"scripts": {
Expand Down
35 changes: 10 additions & 25 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import * as path from "path";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import { IHeaders } from "@actions/http-client/interfaces";
import { default as deepEqual } from "fast-deep-equal";
import * as yaml from "js-yaml";
import { default as queryString } from "query-string";
import * as semver from "semver";

import { isRunningLocalAction, getRelativeScriptPath } from "./actions-util";
import * as api from "./api-client";
import { Config, PackWithVersion } from "./config-utils";
import { PackWithVersion } from "./config-utils";
import * as defaults from "./defaults.json"; // Referenced from codeql-action-sync-tool!
import { errorMatchers } from "./error-matcher";
import { isTracedLanguage, Language } from "./languages";
Expand Down Expand Up @@ -81,7 +80,8 @@ export interface CodeQL {
* Run 'codeql database init --db-cluster'.
*/
databaseInitCluster(
config: Config,
databasePath: string,
languages: Language[],
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined
Expand Down Expand Up @@ -220,7 +220,6 @@ const CODEQL_VERSION_GROUP_RULES = "2.5.5";
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
export const CODEQL_VERSION_COUNTS_LINES = "2.6.2";
const CODEQL_VERSION_CUSTOM_QUERY_HELP = "2.7.1";
const CODEQL_VERSION_CONFIG_FILES = "2.7.3";
export const CODEQL_VERSION_ML_POWERED_QUERIES = "2.7.5";

/**
Expand Down Expand Up @@ -693,35 +692,26 @@ async function getCodeQLForCmd(
]);
},
async databaseInitCluster(
config: Config,
databasePath: string,
languages: Language[],
sourceRoot: string,
processName: string | undefined,
processLevel: number | undefined
) {
const extraArgs = config.languages.map(
(language) => `--language=${language}`
);
if (config.languages.filter(isTracedLanguage).length > 0) {
const extraArgs = languages.map((language) => `--language=${language}`);
if (languages.filter(isTracedLanguage).length > 0) {
extraArgs.push("--begin-tracing");
if (processName !== undefined) {
extraArgs.push(`--trace-process-name=${processName}`);
} else {
// We default to 3 if no other arguments are provided since this was the default
// behaviour of the Runner. Note this path never happens in the CodeQL Action
// because that always passes in a process name.
extraArgs.push(`--trace-process-level=${processLevel || 3}`);
}
}
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_CONFIG_FILES)) {
const configLocation = path.resolve(config.tempDir, "user-config.yaml");
fs.writeFileSync(configLocation, yaml.dump(config.originalUserInput));
extraArgs.push(`--codescanning-config=${configLocation}`);
}
await runTool(cmd, [
"database",
"init",
"--db-cluster",
config.dbLocation,
databasePath,
`--source-root=${sourceRoot}`,
...extraArgs,
...getExtraOptionsFromEnv(["database", "init"]),
Expand Down Expand Up @@ -874,9 +864,7 @@ async function getCodeQLForCmd(
if (extraSearchPath !== undefined) {
codeqlArgs.push("--additional-packs", extraSearchPath);
}
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
codeqlArgs.push(querySuitePath);
}
codeqlArgs.push(querySuitePath);
await runTool(cmd, codeqlArgs);
},
async databaseInterpretResults(
Expand Down Expand Up @@ -911,10 +899,7 @@ async function getCodeQLForCmd(
) {
codeqlArgs.push("--sarif-category", automationDetailsId);
}
codeqlArgs.push(databasePath);
if (!(await util.codeQlVersionAbove(this, CODEQL_VERSION_CONFIG_FILES))) {
codeqlArgs.push(...querySuitePaths);
}
codeqlArgs.push(databasePath, ...querySuitePaths);
// capture stdout, which contains analysis summaries
return await runTool(cmd, codeqlArgs);
},
Expand Down
3 changes: 2 additions & 1 deletion src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export async function runInit(
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
// Init a database cluster
await codeql.databaseInitCluster(
config,
config.dbLocation,
config.languages,
sourceRoot,
processName,
processLevel
Expand Down

0 comments on commit 72f407c

Please sign in to comment.