github / github/codeql-cli-binaries
Cannot access CodeQL environment variables in `database create --command`
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 1k
- Forks
- 184
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
Línea de trabajo
Comienza con el punto de entrada `codeql database create --command` y la expansión de variables de sus argumentos, usando los ejemplos reportados `CODEQL_EXTRACTOR_JAVASCRIPT_ROOT` y `env.` como casos de reproducción. Traza por qué el entorno del comando no está disponible durante la expansión; el trabajo estará terminado cuando la ruta del autobuilder de JavaScript pueda proporcionarse mediante la variable de entorno de CodeQL y el comportamiento esté cubierto por una prueba adecuada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, shell
- Área
- cli
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100