Skip to content

Commit 8b37404

Browse files
Merge pull request #883 from github/update-v1.0.30-a7adbce2
Merge main into v1
2 parents 384cfc4 + c180f23 commit 8b37404

14 files changed

+86
-37
lines changed

Diff for: CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CodeQL Action and CodeQL Runner Changelog
22

3+
## 1.0.30 - 24 Jan 2022
4+
5+
- Display a better error message when encountering a workflow that runs the `codeql-action/init` action multiple times. [#876](https://github.com/github/codeql-action/pull/876)
6+
- Update default CodeQL bundle version to 2.7.6. [#877](https://github.com/github/codeql-action/pull/877)
7+
38
## 1.0.29 - 21 Jan 2022
49

510
- The feature to wait for SARIF processing to complete after upload has been disabled by default due to a bug in its interaction with pull requests from forks.
@@ -11,7 +16,7 @@
1116

1217
## 1.0.27 - 11 Jan 2022
1318

14-
- The `analyze` and `upload-sarif` actions will now wait up to 2 minutes for processing to complete after they have uploaded the results so they can report any processing errors that occurred. This behavior can be disabled by setting the `wait-for-processing` action input to `"false"`.
19+
- The `analyze` and `upload-sarif` actions will now wait up to 2 minutes for processing to complete after they have uploaded the results so they can report any processing errors that occurred. This behavior can be disabled by setting the `wait-for-processing` action input to `"false"`. [#855](https://github.com/github/codeql-action/pull/855)
1520

1621
## 1.0.26 - 10 Dec 2021
1722

Diff for: lib/codeql.js

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/defaults.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"bundleVersion": "codeql-bundle-20220112"
2+
"bundleVersion": "codeql-bundle-20220120"
33
}

Diff for: lib/init.js

+22-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/init.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: node_modules/.package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeql",
3-
"version": "1.0.29",
3+
"version": "1.0.30",
44
"private": true,
55
"description": "CodeQL action",
66
"scripts": {

Diff for: runner/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: runner/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeql-runner",
3-
"version": "1.0.29",
3+
"version": "1.0.30",
44
"private": true,
55
"description": "CodeQL runner",
66
"scripts": {

Diff for: src/codeql.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,12 @@ async function getCodeQLForCmd(
805805
await toolrunnerErrorCatcher(cmd, args, errorMatchers);
806806
},
807807
async resolveLanguages() {
808-
const codeqlArgs = ["resolve", "languages", "--format=json"];
808+
const codeqlArgs = [
809+
"resolve",
810+
"languages",
811+
"--format=json",
812+
...getExtraOptionsFromEnv(["resolve", "languages"]),
813+
];
809814
const output = await runTool(cmd, codeqlArgs);
810815

811816
try {
@@ -956,6 +961,7 @@ async function getCodeQLForCmd(
956961
"cleanup",
957962
databasePath,
958963
`--mode=${cleanupLevel}`,
964+
...getExtraOptionsFromEnv(["database", "cleanup"]),
959965
];
960966
await runTool(cmd, codeqlArgs);
961967
},
@@ -970,6 +976,7 @@ async function getCodeQLForCmd(
970976
databasePath,
971977
`--output=${outputFilePath}`,
972978
`--name=${databaseName}`,
979+
...getExtraOptionsFromEnv(["database", "bundle"]),
973980
];
974981
await new toolrunner.ToolRunner(cmd, args).exec();
975982
},

Diff for: src/defaults.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"bundleVersion": "codeql-bundle-20220112"
2+
"bundleVersion": "codeql-bundle-20220120"
33
}

Diff for: src/init.ts

+32-17
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,41 @@ export async function runInit(
9191
): Promise<TracerConfig | undefined> {
9292
fs.mkdirSync(config.dbLocation, { recursive: true });
9393

94-
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
95-
// Init a database cluster
96-
await codeql.databaseInitCluster(
97-
config.dbLocation,
98-
config.languages,
99-
sourceRoot,
100-
processName,
101-
processLevel
102-
);
103-
} else {
104-
for (const language of config.languages) {
105-
// Init language database
106-
await codeql.databaseInit(
107-
util.getCodeQLDatabasePath(config, language),
108-
language,
109-
sourceRoot
94+
try {
95+
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
96+
// Init a database cluster
97+
await codeql.databaseInitCluster(
98+
config.dbLocation,
99+
config.languages,
100+
sourceRoot,
101+
processName,
102+
processLevel
103+
);
104+
} else {
105+
for (const language of config.languages) {
106+
// Init language database
107+
await codeql.databaseInit(
108+
util.getCodeQLDatabasePath(config, language),
109+
language,
110+
sourceRoot
111+
);
112+
}
113+
}
114+
} catch (e) {
115+
// Handle the situation where init is called twice
116+
// for the same database in the same job.
117+
if (
118+
e instanceof Error &&
119+
e.message?.includes("Refusing to create databases") &&
120+
e.message.includes("exists and is not an empty directory.")
121+
) {
122+
throw new Error(
123+
`Is the "init" action called twice in the same job? ${e.message}`
110124
);
125+
} else {
126+
throw e;
111127
}
112128
}
113-
114129
return await getCombinedTracerConfig(config, codeql);
115130
}
116131

0 commit comments

Comments
 (0)