Improve clarity of logging

This commit is contained in:
Henry Mercer 2022-09-01 12:56:03 +01:00
parent 8e0846caf0
commit fe1bd9ac76
3 changed files with 25 additions and 25 deletions

23
lib/analyze-action.js generated
View file

@ -107,25 +107,26 @@ function doesGoExtractionOutputExist(config) {
* - We approximate whether manual build steps are present by looking at
* whether any extraction output already exists for Go.
*/
async function runGoAutobuilderIfLegacyWorkflow(config, featureFlags, logger) {
// Only proceed if the beta Go extraction reconciliation behavior is
// enabled.
if (process.env["CODEQL_ACTION_RECONCILE_GO_EXTRACTION"] !== "true" &&
!(await featureFlags.getValue(feature_flags_1.FeatureFlag.GolangExtractionReconciliationEnabled))) {
logger.debug("Won't run the Go autobuilder since Go extraction reconciliation is not enabled.");
async function runAutobuildIfLegacyGoWorkflow(config, featureFlags, logger) {
if (!config.languages.includes(languages_1.Language.go)) {
return;
}
if (!config.languages.includes(languages_1.Language.go)) {
logger.info("Won't run the Go autobuilder since Go analysis is not enabled.");
if (process.env["CODEQL_ACTION_RECONCILE_GO_EXTRACTION"] !== "true" &&
!(await featureFlags.getValue(feature_flags_1.FeatureFlag.GolangExtractionReconciliationEnabled))) {
logger.debug("Won't run Go autobuild since Go extraction reconciliation is not enabled.");
return;
}
if (process.env["CODEQL_ACTION_DID_AUTOBUILD_GOLANG"] === "true") {
logger.info("Won't run the Go autobuilder since it has already been run.");
// This log line is info level while Go extraction reconciliation is in beta.
// We will make it debug level once Go extraction reconciliation is GA.
logger.info("Won't run Go autobuild since it has already been run.");
return;
}
// This captures whether a user has added manual build steps for Go
if (doesGoExtractionOutputExist(config)) {
logger.info("Won't run the Go autobuilder since at least one file of Go code has already been extracted.");
// This log line is info level while Go extraction reconciliation is in beta.
// We will make it debug level once Go extraction reconciliation is GA.
logger.info("Won't run Go autobuild since at least one file of Go code has already been extracted.");
return;
}
await (0, autobuild_1.runAutobuild)(languages_1.Language.go, config, logger);
@ -164,7 +165,7 @@ async function run() {
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
const gitHubVersion = await (0, api_client_1.getGitHubVersionActionsOnly)();
const featureFlags = new feature_flags_1.GitHubFeatureFlags(gitHubVersion, apiDetails, repositoryNwo, logger);
await runGoAutobuilderIfLegacyWorkflow(config, featureFlags, logger);
await runAutobuildIfLegacyGoWorkflow(config, featureFlags, logger);
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, featureFlags);
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);

File diff suppressed because one or more lines are too long