Tolerate failures in uploading debug artifacts
This commit is contained in:
parent
d061f2cdd0
commit
80d7a6c8d4
3 changed files with 57 additions and 44 deletions
41
lib/debug-artifacts.js
generated
41
lib/debug-artifacts.js
generated
|
|
@ -87,7 +87,7 @@ function tryGetSarifResultPath(config, language, logger) {
|
|||
}
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to find SARIF results path for ${language}. ${(0, util_1.wrapError)(e)}`);
|
||||
logger.warning(`Failed to find SARIF results path for ${language}. ${(0, util_1.wrapError)(e).message}`);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
|
@ -101,29 +101,34 @@ async function tryBundleDatabase(config, language, logger) {
|
|||
}
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to bundle database for ${language}. ${(0, util_1.wrapError)(e)}`);
|
||||
logger.warning(`Failed to bundle database for ${language}. ${(0, util_1.wrapError)(e).message}`);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
async function uploadAllAvailableDebugArtifacts(config, logger) {
|
||||
const filesToUpload = [];
|
||||
for (const language of config.languages) {
|
||||
filesToUpload.push(...tryGetSarifResultPath(config, language, logger));
|
||||
// Add any log files
|
||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const logsDirectory = path.resolve(databaseDirectory, "log");
|
||||
if ((0, util_1.doesDirectoryExist)(logsDirectory)) {
|
||||
filesToUpload.push(...(0, util_1.listFolder)(logsDirectory));
|
||||
try {
|
||||
const filesToUpload = [];
|
||||
for (const language of config.languages) {
|
||||
filesToUpload.push(...tryGetSarifResultPath(config, language, logger));
|
||||
// Add any log files
|
||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const logsDirectory = path.resolve(databaseDirectory, "log");
|
||||
if ((0, util_1.doesDirectoryExist)(logsDirectory)) {
|
||||
filesToUpload.push(...(0, util_1.listFolder)(logsDirectory));
|
||||
}
|
||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||
const multiLanguageTracingLogsDirectory = path.resolve(config.dbLocation, "log");
|
||||
if ((0, util_1.doesDirectoryExist)(multiLanguageTracingLogsDirectory)) {
|
||||
filesToUpload.push(...(0, util_1.listFolder)(multiLanguageTracingLogsDirectory));
|
||||
}
|
||||
// Add database bundle
|
||||
filesToUpload.push(...(await tryBundleDatabase(config, language, logger)));
|
||||
}
|
||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||
const multiLanguageTracingLogsDirectory = path.resolve(config.dbLocation, "log");
|
||||
if ((0, util_1.doesDirectoryExist)(multiLanguageTracingLogsDirectory)) {
|
||||
filesToUpload.push(...(0, util_1.listFolder)(multiLanguageTracingLogsDirectory));
|
||||
}
|
||||
// Add database bundle
|
||||
filesToUpload.push(...(await tryBundleDatabase(config, language, logger)));
|
||||
await uploadDebugArtifacts(filesToUpload, config.dbLocation, config.debugArtifactName);
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Failed to upload debug artifacts: ${(0, util_1.wrapError)(e).message}`);
|
||||
}
|
||||
await uploadDebugArtifacts(filesToUpload, config.dbLocation, config.debugArtifactName);
|
||||
}
|
||||
async function uploadDebugArtifacts(toUpload, rootDir, artifactName) {
|
||||
if (toUpload.length === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue