Skip to content

Commit f422a50

Browse files
authored
Honor the Lua tracer FF for database trace-command invocations for scanned languages.
In theory, a scanned language will not setup the build tracer, and so shouldn't care about lua versus legacy tracing. However, `go` is a special case where the autobuilder runs under the build tracer, that then gets disabled immediately again, unless a special environment variable is used. Therefore, we need to thread through the feature flag to this `database trace-command` invocation. For other scanned languages, this should be a no-op, as no tracing is ever set up.
1 parent 47bcabd commit f422a50

12 files changed

Lines changed: 85 additions & 23 deletions

‎lib/analyze-action.js‎

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/analyze-action.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/analyze.js‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/analyze.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/codeql.js‎

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/codeql.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/runner.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/runner.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/analyze-action.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import {
1212
runQueries,
1313
runFinalize,
1414
} from "./analyze";
15+
import { getGitHubVersionActionsOnly } from "./api-client";
1516
import { CODEQL_VERSION_NEW_TRACING, getCodeQL } from "./codeql";
1617
import { Config, getConfig } from "./config-utils";
1718
import { uploadDatabases } from "./database-upload";
19+
import { GitHubFeatureFlags } from "./feature-flags";
1820
import { getActionsLogger } from "./logging";
1921
import { parseRepositoryNwo } from "./repository";
2022
import * as upload_lib from "./upload-lib";
@@ -112,7 +114,16 @@ async function run() {
112114
util.getRequiredEnvParam("GITHUB_REPOSITORY")
113115
);
114116

115-
await runFinalize(outputDir, threads, memory, config, logger);
117+
const gitHubVersion = await getGitHubVersionActionsOnly();
118+
119+
const featureFlags = new GitHubFeatureFlags(
120+
gitHubVersion,
121+
apiDetails,
122+
repositoryNwo,
123+
logger
124+
);
125+
126+
await runFinalize(outputDir, threads, memory, config, logger, featureFlags);
116127
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
117128
runStats = await runQueries(
118129
outputDir,

‎src/analyze.ts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from "./codeql";
1414
import * as configUtils from "./config-utils";
1515
import { countLoc } from "./count-loc";
16+
import { FeatureFlags } from "./feature-flags";
1617
import { isScannedLanguage, Language } from "./languages";
1718
import { Logger } from "./logging";
1819
import * as sharedEnv from "./shared-environment";
@@ -116,7 +117,8 @@ async function setupPythonExtractor(logger: Logger) {
116117

117118
async function createdDBForScannedLanguages(
118119
config: configUtils.Config,
119-
logger: Logger
120+
logger: Logger,
121+
featureFlags: FeatureFlags
120122
) {
121123
// Insert the LGTM_INDEX_X env vars at this point so they are set when
122124
// we extract any scanned languages.
@@ -136,7 +138,8 @@ async function createdDBForScannedLanguages(
136138

137139
await codeql.extractScannedLanguage(
138140
util.getCodeQLDatabasePath(config, language),
139-
language
141+
language,
142+
featureFlags
140143
);
141144
logger.endGroup();
142145
}
@@ -166,9 +169,10 @@ async function finalizeDatabaseCreation(
166169
config: configUtils.Config,
167170
threadsFlag: string,
168171
memoryFlag: string,
169-
logger: Logger
172+
logger: Logger,
173+
featureFlags: FeatureFlags
170174
) {
171-
await createdDBForScannedLanguages(config, logger);
175+
await createdDBForScannedLanguages(config, logger, featureFlags);
172176

173177
const codeql = await getCodeQL(config.codeQLCmd);
174178
for (const language of config.languages) {
@@ -425,7 +429,8 @@ export async function runFinalize(
425429
threadsFlag: string,
426430
memoryFlag: string,
427431
config: configUtils.Config,
428-
logger: Logger
432+
logger: Logger,
433+
featureFlags: FeatureFlags
429434
) {
430435
const codeql = await getCodeQL(config.codeQLCmd);
431436
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
@@ -445,7 +450,13 @@ export async function runFinalize(
445450
}
446451
await fs.promises.mkdir(outputDir, { recursive: true });
447452

448-
await finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger);
453+
await finalizeDatabaseCreation(
454+
config,
455+
threadsFlag,
456+
memoryFlag,
457+
logger,
458+
featureFlags
459+
);
449460
}
450461

451462
export async function runCleanup(

0 commit comments

Comments
 (0)