Skip to content

Support CODEQL_SCRATCH_DIR #451

@hmakholm

Description

@hmakholm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions