github / github/codeql-cli-binaries
Cannot access CodeQL environment variables in `database create --command`
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 1k
- Fork
- 184
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I would like to explicitly invoke the JavaScript autobuilder as part of `codeql database create`, with the ultimate goal of passing it some custom options. However, even invoking it without any options isn't as easy as I would have hoped, since I cannot figure out how to access CodeQL environment variables to specify the path to the autobuilder.
My first attempt of
```sh
codeql database create -l javascript --command '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh /path/to/database
```
was met with
```sh
A fatal error occurred: Failed to expand '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh' as an argument list.
(eventual cause: UserError "Attempting to expand unknown variable: CODEQL_EXTRACTOR_JAVASCRIPT_ROOT, available variables are: []")
```
@lcartey suggested adding `env.` like so:
```sh
codeql database create -l javascript --command '${env.CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh' /path/to/database
```
but that resulted in
```
A fatal error occurred: Failed to expand '${env.CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}/tools/autobuild.sh' as an argument list.
(eventual cause: UserError "Attempting to expand unknown variable: env.CODEQL_EXTRACTOR_JAVASCRIPT_ROOT, ava...")
```
I am pretty sure this is the right environment variable name, cf. [here](https://git.semmle.com/Semmle/code/blob/master/language-packs/javascript/tools/autobuild.sh#L28).
Specifying the full path to the autobuild script is, of course, possible, but annoying.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia dal punto di ingresso `codeql database create --command` e dall’espansione delle variabili degli argomenti, usando gli esempi segnalati `CODEQL_EXTRACTOR_JAVASCRIPT_ROOT` e `env.` come casi di riproduzione. Traccia il motivo per cui l’ambiente del comando non è disponibile durante l’espansione; il lavoro è completato quando il percorso dell’autobuilder JavaScript può essere fornito tramite la variabile d’ambiente di CodeQL e il comportamento è coperto da un test appropriato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, shell
- Ambito
- cli
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100