Fix a bug in cli config parsing
When the config specifies queries in external repositories and no other queries and cli config parsing is enabled, the analyze job is not able to find any queries to run and it fails. This PR fixes the problem. Also add some logging statements when writing a copy of the user config file.
This commit is contained in:
parent
40cfcb0a3f
commit
9b1206e898
6 changed files with 42 additions and 24 deletions
|
|
@ -855,7 +855,8 @@ async function getCodeQLForCmd(
|
|||
config: Config,
|
||||
sourceRoot: string,
|
||||
processName: string | undefined,
|
||||
featureEnablement: FeatureEnablement
|
||||
featureEnablement: FeatureEnablement,
|
||||
logger: Logger
|
||||
) {
|
||||
const extraArgs = config.languages.map(
|
||||
(language) => `--language=${language}`
|
||||
|
|
@ -888,7 +889,8 @@ async function getCodeQLForCmd(
|
|||
const configLocation = await generateCodeScanningConfig(
|
||||
codeql,
|
||||
config,
|
||||
featureEnablement
|
||||
featureEnablement,
|
||||
logger
|
||||
);
|
||||
// Only pass external repository token if a config file is going to be parsed by the CLI.
|
||||
let externalRepositoryToken: string | undefined;
|
||||
|
|
@ -1386,7 +1388,8 @@ async function runTool(
|
|||
async function generateCodeScanningConfig(
|
||||
codeql: CodeQL,
|
||||
config: Config,
|
||||
featureEnablement: FeatureEnablement
|
||||
featureEnablement: FeatureEnablement,
|
||||
logger: Logger
|
||||
): Promise<string | undefined> {
|
||||
if (!(await util.useCodeScanningConfigInCli(codeql, featureEnablement))) {
|
||||
return;
|
||||
|
|
@ -1448,6 +1451,10 @@ async function generateCodeScanningConfig(
|
|||
augmentedConfig.packs["javascript"].push(packString);
|
||||
}
|
||||
}
|
||||
logger.info(`Writing augmented user configuration file to ${configLocation}`);
|
||||
logger.startGroup("Augmented user configuration file contents");
|
||||
logger.info(yaml.dump(augmentedConfig));
|
||||
logger.endGroup();
|
||||
|
||||
fs.writeFileSync(configLocation, yaml.dump(augmentedConfig));
|
||||
return configLocation;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue