Sitelet https://web.archive.org/web/20240113191525/https://github.com/github/codeql-action/issues/451
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CODEQL_SCRATCH_DIR #451

Closed
hmakholm opened this issue Apr 19, 2021 · 2 comments
Closed

Support CODEQL_SCRATCH_DIR #451

hmakholm opened this issue Apr 19, 2021 · 2 comments

Comments

@hmakholm
Copy link
Contributor

Release 2.5.1 CodeQL CLI introduces a $CODEQL_SCRATCH_DIR environment variable that is intended for the tracer to use when it needs a scratch location that is not language specific.

Unfortunately for technical reasons its value is actually set to something that includes a language tag. This creates trouble when the action attempts to trace multiple languages at the same time, and the various codeql database trace-command invocation disagree about how it should be set.

/home/runner/work/_temp/codeql_databases/java: Running in /home/runner/work/codeql-action/codeql-action: [/home/runner/runners/2.278.0/externals/node12/bin/node, /home/runner/work/_temp/codeql_databases/java/working/tracer-env.js, /home/runner/work/_temp/codeql_databases/java/working/env.tmp]
[2021-04-19 17:19:06] [build-stdout] /home/runner/work/_temp/codeql_databases/java/working/env.tmp
Error: Incompatible values in environment parameter CODEQL_SCRATCH_DIR: /home/runner/work/_temp/codeql_databases/cpp/working/codeql-scratch and /home/runner/work/_temp/codeql_databases/csharp/working/codeql-scratch
Error: Incompatible values in environment parameter CODEQL_SCRATCH_DIR: /home/runner/work/_temp/codeql_databases/cpp/working/codeql-scratch and /home/runner/work/_temp/codeql_databases/csharp/working/codeql-scratch
    at concatTracerConfigs (/home/runner/work/codeql-action/action/lib/tracer-config.js:65:27)
    at Object.getCombinedTracerConfig (/home/runner/work/codeql-action/action/lib/tracer-config.js:134:30)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.runInit (/home/runner/work/codeql-action/action/lib/init.js:43:12)
    at async run (/home/runner/work/codeql-action/action/lib/init-action.js:100:30)
    at async runWrapper (/home/runner/work/codeql-action/action/lib/init-action.js:121:9)

(https://github.com/github/codeql-action/pull/450/checks?check_run_id=2383141232)

The best way out of this seems to be to special-case the name CODEQL_SCRATCH_DIR in the runner and let it generate an initially-empty-but-existing scratch location of its own, ignoring what trace-command wants it to be.

This blocks the release of a bundle that contains 2.5.1.

@hmakholm
Copy link
Contributor Author

So far this was handled by rolling back $CODEQL_SCRATCH_DIR from the CLI in release 2.5.2.

It is still not clearly decided to which degree we need new CLIs to be compatible with old versions of the action and/or runner, but it might be useful for a future strategy to prepare the action/runner to accept diverging values from the CLI and substitute its own idea of where a useful scratch directory would be.

@hmakholm
Copy link
Contributor Author

hmakholm commented Oct 26, 2021 •

This was eventually fixed a few versions later, by means of the CLI detecting it was being run from the Action, and adapting the value accordingly.

Later yet, the action will switch to using the CLI's native support for multi-language tracing -- so there's nothing specific to be done for $CODEQL_SCRATCH_DIR in the action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant