Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fall back to partial database bundle if CLI command fails
  • Loading branch information
henrymercer committed Sep 16, 2024
commit bbd7c801a0b6c54f8a6e7837e6b87763242aab6e
23 changes: 13 additions & 10 deletions lib/debug-artifacts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/debug-artifacts.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 20 additions & 9 deletions src/debug-artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function tryGetSarifResultPath(
}
} catch (e) {
logger.warning(
`Failed to find SARIF results path for ${language}. ${
`Failed to find SARIF results path for ${language}. Reason: ${
wrapError(e).message
}`,
);
Expand All @@ -108,14 +108,22 @@ async function tryBundleDatabase(
logger: Logger,
): Promise<string[]> {
try {
if (!dbIsFinalized(config, language, logger)) {
return [await createPartialDatabaseBundle(config, language)];
} else {
return [await createDatabaseBundleCli(config, language)];
if (dbIsFinalized(config, language, logger)) {
try {
return [await createDatabaseBundleCli(config, language)];
} catch (e) {
logger.warning(
`Failed to bundle database for ${language} using the CLI. ` +
`Falling back to a partial bundle. Reason: ${wrapError(e).message}`,
);
}
}
return [await createPartialDatabaseBundle(config, language)];
} catch (e) {
logger.warning(
`Failed to bundle database for ${language}. ${wrapError(e).message}`,
`Failed to bundle database for ${language}. Reason: ${
wrapError(e).message
}`,
);
return [];
}
Expand Down Expand Up @@ -159,7 +167,9 @@ export async function uploadAllAvailableDebugArtifacts(
config.debugArtifactName,
);
} catch (e) {
logger.warning(`Failed to upload debug artifacts: ${wrapError(e).message}`);
logger.warning(
`Failed to upload debug artifacts. Reason: ${wrapError(e).message}`,
);
}
}

Expand Down Expand Up @@ -199,7 +209,9 @@ export async function uploadDebugArtifacts(
);
} catch (e) {
// A failure to upload debug artifacts should not fail the entire action.
core.warning(`Failed to upload debug artifacts: ${e}`);
core.warning(
`Failed to upload debug artifacts. Reason: ${wrapError(e).message}`,
);
}
}

Expand Down Expand Up @@ -237,7 +249,6 @@ async function createDatabaseBundleCli(
config: Config,
language: Language,
): Promise<string> {
// Otherwise run `codeql database bundle` command.
const databaseBundlePath = await bundleDb(
config,
language,
Expand Down