Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add warnings about CLI hack to codeql.ts
These warnings refer to a hack that was added to the CLI in
https://github.com/github/semmle-code/pull/39335

They can be removed again once the CLI has a more principled way for
the CLI to recognize that it's being invoked by the runner/action.
Henning Makholm committed May 14, 2021
1 parent 97887fe commit e7d4215
Showing 3 changed files with 27 additions and 1 deletion.
12 changes: 12 additions & 0 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
14 changes: 14 additions & 0 deletions src/codeql.ts
@@ -508,11 +508,18 @@ function getCodeQLForCmd(cmd: string): CodeQL {
},
async getTracerEnv(databasePath: string) {
// Write tracer-env.js to a temp location.
// BEWARE: The name and location of this file is recognized by `codeql database
// trace-command` in order to enable special support for concatenable tracer
// configurations. Consequently the name must not be changed.
// (This warning can be removed once a different way to recognize the
// action/runner has been implemented in `codeql database trace-command`
// _and_ is present in the latest supported CLI release.)
const tracerEnvJs = path.resolve(
databasePath,
"working",
"tracer-env.js"
);

fs.mkdirSync(path.dirname(tracerEnvJs), { recursive: true });
fs.writeFileSync(
tracerEnvJs,
@@ -530,7 +537,14 @@ function getCodeQLForCmd(cmd: string): CodeQL {
fs.writeFileSync(process.argv[2], JSON.stringify(env), 'utf-8');`
);

// BEWARE: The name and location of this file is recognized by `codeql database
// trace-command` in order to enable special support for concatenable tracer
// configurations. Consequently the name must not be changed.
// (This warning can be removed once a different way to recognize the
// action/runner has been implemented in `codeql database trace-command`
// _and_ is present in the latest supported CLI release.)
const envFile = path.resolve(databasePath, "working", "env.tmp");

await new toolrunner.ToolRunner(cmd, [
"database",
"trace-command",

0 comments on commit e7d4215

Please sign in to comment.