diff --git a/src/analyze.test.ts b/src/analyze.test.ts index f55bdf67c..e957b7384 100644 --- a/src/analyze.test.ts +++ b/src/analyze.test.ts @@ -44,7 +44,6 @@ test("status report fields", async (t) => { for (const language of Object.values(KnownLanguage)) { const codeql = createStubCodeQL({ databaseRunQueries: async () => {}, - packDownload: async () => ({ packs: [] }), databaseInterpretResults: async ( _db: string, _queriesRun: string[], diff --git a/src/codeql.ts b/src/codeql.ts index e34466e6f..bd2400d3b 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -136,14 +136,6 @@ export interface CodeQL { language: string, ): Promise; - /** - * Run 'codeql pack download'. - */ - packDownload( - packs: string[], - qlconfigFile: string | undefined, - ): Promise; - /** * Clean up all the databases within a database cluster. */ @@ -256,17 +248,6 @@ export interface ResolveBuildEnvironmentOutput { }; } -export interface PackDownloadOutput { - packs: PackDownloadItem[]; -} - -interface PackDownloadItem { - name: string; - version: string; - packDir: string; - installResult: string; -} - /** * Stores the CodeQL object, and is populated by `setupCodeQL` or `getCodeQL`. */ @@ -478,7 +459,6 @@ export function createStubCodeQL(partialCodeql: Partial): CodeQL { partialCodeql, "resolveBuildEnvironment", ), - packDownload: resolveFunction(partialCodeql, "packDownload"), databaseCleanupCluster: resolveFunction( partialCodeql, "databaseCleanupCluster", @@ -888,59 +868,6 @@ export async function getCodeQLForCmd( ]; return await runCli(cmd, codeqlArgs); }, - - /** - * Download specified packs into the package cache. If the specified - * package and version already exists (e.g., from a previous analysis run), - * then it is not downloaded again (unless the extra option `--force` is - * specified). - * - * 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[], - qlconfigFile: string | undefined, - ): Promise { - const qlconfigArg = qlconfigFile - ? [`--qlconfig-file=${qlconfigFile}`] - : ([] as string[]); - - const codeqlArgs = [ - "pack", - "download", - ...qlconfigArg, - "--format=json", - "--resolve-query-specs", - ...getExtraOptionsFromEnv(["pack", "download"]), - ...packs, - ]; - - const output = await runCli(cmd, codeqlArgs); - - try { - const parsedOutput: PackDownloadOutput = JSON.parse(output); - if ( - Array.isArray(parsedOutput.packs) && - // TODO PackDownloadOutput will not include the version if it is not specified - // in the input. The version is always the latest version available. - // It should be added to the output, but this requires a CLI change - parsedOutput.packs.every((p) => p.name /* && p.version */) - ) { - return parsedOutput; - } else { - throw new Error("Unexpected output from pack download"); - } - } catch (e) { - throw new Error( - `Attempted to download specified packs but got an error:\n${output}\n${e}`, - ); - } - }, async databaseCleanupCluster( config: Config, cleanupLevel: string, diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index cd47fac05..7f8df74ef 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -9,7 +9,7 @@ import * as sinon from "sinon"; import * as actionsUtil from "./actions-util"; import * as api from "./api-client"; import { CachingKind } from "./caching-utils"; -import { PackDownloadOutput, createStubCodeQL } from "./codeql"; +import { createStubCodeQL } from "./codeql"; import * as configUtils from "./config-utils"; import { Feature } from "./feature-flags"; import * as gitUtils from "./git-utils"; @@ -143,9 +143,6 @@ test("load empty config", async (t) => { }, }; }, - async packDownload(): Promise { - return { packs: [] }; - }, }); const config = await configUtils.initConfig( @@ -185,9 +182,6 @@ test("loading config saves config", async (t) => { }, }; }, - async packDownload(): Promise { - return { packs: [] }; - }, }); // Sanity check the saved config file does not already exist @@ -310,9 +304,6 @@ test("load non-empty input", async (t) => { }, }; }, - async packDownload(): Promise { - return { packs: [] }; - }, }); // Just create a generic config object with non-default values for all fields @@ -407,9 +398,6 @@ test("Using config input and file together, config input should be used.", async }, }; }, - async packDownload(): Promise { - return { packs: [] }; - }, }); // Only JS, python packs will be ignored @@ -440,9 +428,6 @@ test("API client used when reading remote config", async (t) => { }, }; }, - async packDownload(): Promise { - return { packs: [] }; - }, }); const inputFileContents = ` @@ -542,9 +527,6 @@ test("No detected languages", async (t) => { async resolveLanguages() { return {}; }, - async packDownload(): Promise { - return { packs: [] }; - }, }); try {