Add support for downloading packs from GHES
This change adds:
- new `registries` block allowed in code scanning config file
- new `registries-auth-tokens` input in init action
- Change the downloadPacks function so that it accepts new parameters:
- registries block
- api auth
- Generate a qlconfig.yml file with the registries block if one is
supplied. Use this file when downloading packs.
- temporarily set the `GITHUB_TOKEN` and `CODEQL_REGISTRIES_AUTH` based
on api auth
TODO:
1. integration test
2. handle pack downloads when the config is generated by the CLI
This commit is contained in:
parent
c7bb8946b2
commit
0e98efa2bb
37 changed files with 428 additions and 103 deletions
|
|
@ -134,7 +134,10 @@ export interface CodeQL {
|
|||
/**
|
||||
* Run 'codeql pack download'.
|
||||
*/
|
||||
packDownload(packs: string[]): Promise<PackDownloadOutput>;
|
||||
packDownload(
|
||||
packs: string[],
|
||||
qlconfigFile: string | undefined
|
||||
): Promise<PackDownloadOutput>;
|
||||
|
||||
/**
|
||||
* Run 'codeql database cleanup'.
|
||||
|
|
@ -1086,11 +1089,22 @@ async function getCodeQLForCmd(
|
|||
* If no version is specified, then the latest version is
|
||||
* downloaded. The check to determine what the latest version is is done
|
||||
* each time this package is requested.
|
||||
*
|
||||
* Optionally, a `qlconfigFile` is included. If used, then this file
|
||||
* is used to determine which registry each pack is downloaded from.
|
||||
*/
|
||||
async packDownload(packs: string[]): Promise<PackDownloadOutput> {
|
||||
async packDownload(
|
||||
packs: string[],
|
||||
qlconfigFile: string | undefined
|
||||
): Promise<PackDownloadOutput> {
|
||||
const qlconfigArg = qlconfigFile
|
||||
? [`--qlconfig-file=${qlconfigFile}`]
|
||||
: ([] as string[]);
|
||||
|
||||
const codeqlArgs = [
|
||||
"pack",
|
||||
"download",
|
||||
...qlconfigArg,
|
||||
"--format=json",
|
||||
"--resolve-query-specs",
|
||||
...getExtraOptionsFromEnv(["pack", "download"]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue