@@ -30,6 +30,11 @@ import {
3030 UserConfig ,
3131} from "./config/db-config" ;
3232import { getRemoteConfig } from "./config/file" ;
33+ import {
34+ parseRegistries ,
35+ type RegistryConfigNoCredentials ,
36+ type RegistryConfigWithCredentials ,
37+ } from "./config/pack-registries" ;
3338import {
3439 addNoLanguageDiagnostic ,
3540 makeTelemetryDiagnostic ,
@@ -123,29 +128,6 @@ const OVERLAY_MINIMUM_MEMORY_MB = 5 * 1024;
123128 */
124129const CODEQL_VERSION_REDUCED_OVERLAY_MEMORY_USAGE = "2.24.3" ;
125130
126- export type RegistryConfigWithCredentials = RegistryConfigNoCredentials & {
127- // Token to use when downloading packs from this registry.
128- token : string ;
129- } ;
130-
131- /**
132- * The list of registries and the associated pack globs that determine where each
133- * pack can be downloaded from.
134- */
135- export interface RegistryConfigNoCredentials {
136- // URL of a package registry, eg- https://ghcr.io/v2/
137- url : string ;
138-
139- // List of globs that determine which packs are associated with this registry.
140- packages : string [ ] | string ;
141-
142- // Kind of registry, either "github" or "docker". Default is "docker".
143- // "docker" refers specifically to the GitHub Container Registry, which is the usual way of sharing CodeQL packs.
144- // "github" refers to packs published as content in a GitHub repository. This kind of registry is used in scenarios
145- // where GHCR is not available, such as certain GHES environments.
146- kind ?: "github" | "docker" ;
147- }
148-
149131async function getSupportedLanguageMap (
150132 codeql : CodeQL ,
151133 logger : Logger ,
@@ -1200,29 +1182,6 @@ export async function initConfig(
12001182 return config ;
12011183}
12021184
1203- function parseRegistries (
1204- registriesInput : string | undefined ,
1205- ) : RegistryConfigWithCredentials [ ] | undefined {
1206- try {
1207- return registriesInput
1208- ? ( yaml . load ( registriesInput ) as RegistryConfigWithCredentials [ ] )
1209- : undefined ;
1210- } catch {
1211- throw new ConfigurationError (
1212- "Invalid registries input. Must be a YAML string." ,
1213- ) ;
1214- }
1215- }
1216-
1217- export function parseRegistriesWithoutCredentials (
1218- registriesInput ?: string ,
1219- ) : RegistryConfigNoCredentials [ ] | undefined {
1220- return parseRegistries ( registriesInput ) ?. map ( ( r ) => {
1221- const { url, packages, kind } = r ;
1222- return { url, packages, kind } ;
1223- } ) ;
1224- }
1225-
12261185function isLocal ( configPath : string ) : boolean {
12271186 // If the path starts with ./, look locally
12281187 if ( configPath . indexOf ( "./" ) === 0 ) {
0 commit comments