GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Respect `end-tracing` script instead of deleting one variable · github/codeql-action@84ab7c2

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • analyze.js.map
    • analyze.js
    • tracer-config.js.map
    • tracer-config.js
  • src
    • analyze.ts
    • tracer-config.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/analyze.js‎

Copy file name to clipboardExpand all lines: lib/analyze.js
+10-2Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎lib/analyze.js.map‎

Copy file name to clipboardExpand all lines: lib/analyze.js.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎lib/tracer-config.js‎

Copy file name to clipboardExpand all lines: lib/tracer-config.js
+16-1Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎lib/tracer-config.js.map‎

Copy file name to clipboardExpand all lines: lib/tracer-config.js.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎src/analyze.ts‎

Copy file name to clipboardExpand all lines: src/analyze.ts
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ import * as toolrunner from "@actions/exec/lib/toolrunner";
55
import * as yaml from "js-yaml";
66

77
import * as analysisPaths from "./analysis-paths";
8-
import { CODEQL_VERSION_COUNTS_LINES, getCodeQL } from "./codeql";
8+
import {
9+
CODEQL_VERSION_COUNTS_LINES,
10+
CODEQL_VERSION_NEW_TRACING,
11+
getCodeQL,
12+
} from "./codeql";
913
import * as configUtils from "./config-utils";
1014
import { countLoc } from "./count-loc";
1115
import { isScannedLanguage, Language } from "./languages";
1216
import { Logger } from "./logging";
1317
import * as sharedEnv from "./shared-environment";
18+
import { endTracingForCluster } from "./tracer-config";
1419
import * as util from "./util";
1520

1621
export class CodeQLAnalysisError extends Error {
@@ -409,8 +414,14 @@ export async function runFinalize(
409414
config: configUtils.Config,
410415
logger: Logger
411416
) {
412-
// Delete the tracer config env var to avoid tracing ourselves
413-
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
417+
const codeql = await getCodeQL(config.codeQLCmd);
418+
if (await util.codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
419+
// Delete variables as specified by the end-tracing script
420+
await endTracingForCluster(config);
421+
} else {
422+
// Delete the tracer config env var to avoid tracing ourselves
423+
delete process.env[sharedEnv.ODASA_TRACER_CONFIGURATION];
424+
}
414425

415426
fs.mkdirSync(outputDir, { recursive: true });
416427

Collapse file

‎src/tracer-config.ts‎

Copy file name to clipboardExpand all lines: src/tracer-config.ts
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,30 @@ const CRITICAL_TRACER_VARS = new Set([
2020
"SEMMLE_JAVA_TOOL_OPTIONS",
2121
]);
2222

23+
export async function endTracingForCluster(
24+
config: configUtils.Config
25+
): Promise<void> {
26+
// If there are no traced languages, we don't need to do anything.
27+
if (!config.languages.some(isTracedLanguage)) return;
28+
29+
const endTracingEnvVariables: Map<string, string | undefined> = JSON.parse(
30+
fs.readFileSync(
31+
path.resolve(
32+
config.dbLocation,
33+
"temp/tracingEnvironment/end-tracing.json"
34+
),
35+
"utf8"
36+
)
37+
);
38+
for (const [key, value] of Object.entries(endTracingEnvVariables)) {
39+
if (value !== undefined) {
40+
process.env[key] = value;
41+
} else {
42+
delete process.env[key];
43+
}
44+
}
45+
}
46+
2347
export async function getTracerConfigForCluster(
2448
config: configUtils.Config
2549
): Promise<TracerConfig> {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.