Refactor helper function to util
This commit is contained in:
parent
2c25894c5f
commit
52de49c899
12 changed files with 51 additions and 40 deletions
12
lib/init-action-cleanup.js
generated
12
lib/init-action-cleanup.js
generated
|
|
@ -50,10 +50,10 @@ function listFolder(dir) {
|
|||
async function uploadDatabaseBundleDebugArtifact(config, logger) {
|
||||
for (const language of config.languages) {
|
||||
if (!(0, analyze_1.dbIsFinalized)(config, language, logger)) {
|
||||
core.info(`${config.debugDatabaseName}-${language} is not finalized. Uploading partial database bundle...`);
|
||||
// Zip up files and upload directly.
|
||||
const databasePath = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const databaseBundlePath = path.resolve(config.dbLocation, `${config.debugDatabaseName}.zip`);
|
||||
const databaseBundlePath = path.resolve(config.dbLocation, `${config.debugDatabaseName}-${language}-partial.zip`);
|
||||
core.info(`${config.debugDatabaseName}-${language} is not finalized. Uploading partial database bundle at ${databaseBundlePath}...`);
|
||||
// See `bundleDb` for explanation behind deleting existing db bundle.
|
||||
if (fs.existsSync(databaseBundlePath)) {
|
||||
await (0, del_1.default)(databaseBundlePath, { force: true });
|
||||
|
|
@ -82,14 +82,14 @@ async function uploadLogsDebugArtifact(config) {
|
|||
for (const language of config.languages) {
|
||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const logsDirectory = path.resolve(databaseDirectory, "log");
|
||||
if (actionsUtil.doesDirectoryExist(logsDirectory)) {
|
||||
if ((0, util_1.doesDirectoryExist)(logsDirectory)) {
|
||||
toUpload = toUpload.concat(listFolder(logsDirectory));
|
||||
}
|
||||
}
|
||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
||||
// Multilanguage tracing: there are additional logs in the root of the cluster
|
||||
const multiLanguageTracingLogsDirectory = path.resolve(config.dbLocation, "log");
|
||||
if (actionsUtil.doesDirectoryExist(multiLanguageTracingLogsDirectory)) {
|
||||
if ((0, util_1.doesDirectoryExist)(multiLanguageTracingLogsDirectory)) {
|
||||
toUpload = toUpload.concat(listFolder(multiLanguageTracingLogsDirectory));
|
||||
}
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ async function uploadLogsDebugArtifact(config) {
|
|||
// Before multi-language tracing, we wrote a compound-build-tracer.log in the temp dir
|
||||
if (!(await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING))) {
|
||||
const compoundBuildTracerLogDirectory = path.resolve(config.tempDir, "compound-build-tracer.log");
|
||||
if (actionsUtil.doesDirectoryExist(compoundBuildTracerLogDirectory)) {
|
||||
if ((0, util_1.doesDirectoryExist)(compoundBuildTracerLogDirectory)) {
|
||||
await actionsUtil.uploadDebugArtifacts([compoundBuildTracerLogDirectory], config.tempDir, config.debugArtifactName);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ async function uploadFinalLogsDebugArtifact(config) {
|
|||
for (const language of config.languages) {
|
||||
const databaseDirectory = (0, util_1.getCodeQLDatabasePath)(config, language);
|
||||
const logsDirectory = path.join(databaseDirectory, "log");
|
||||
if (!actionsUtil.doesDirectoryExist(logsDirectory)) {
|
||||
if (!(0, util_1.doesDirectoryExist)(logsDirectory)) {
|
||||
core.info(`Directory ${logsDirectory} does not exist.`);
|
||||
continue; // Skip this language database.
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue