Skip to content

Commit de6fe7e

Browse files
committed
Add job run UUID to SARIF output
1 parent 889597e commit de6fe7e

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

lib/codeql.js

Lines changed: 8 additions & 0 deletions
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/tools-features.js

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

lib/tools-features.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/codeql.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,7 @@ export async function getCodeQLForCmd(
870870
)}`,
871871
"--sarif-group-rules-by-pack",
872872
...(await getCodeScanningQueryHelpArguments(this)),
873+
...(await getJobRunUuidSarifOptions(this)),
873874
...getExtraOptionsFromEnv(["database", "interpret-results"]),
874875
];
875876
if (automationDetailsId !== undefined) {
@@ -1423,3 +1424,14 @@ function applyAutobuildAzurePipelinesTimeoutFix() {
14231424
"-Dmaven.wagon.http.pool=false",
14241425
].join(" ");
14251426
}
1427+
1428+
async function getJobRunUuidSarifOptions(codeql: CodeQL) {
1429+
const jobRunUuid = process.env[EnvVar.JOB_RUN_UUID];
1430+
1431+
return jobRunUuid &&
1432+
(await codeql.supportsFeature(
1433+
ToolsFeature.DatabaseInterpretResultsSupportsSarifRunProperty,
1434+
))
1435+
? [`--sarif-run-property=jobRunUuid=${jobRunUuid}`]
1436+
: [];
1437+
}

src/tools-features.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { VersionInfo } from "./codeql";
33
export enum ToolsFeature {
44
AnalysisSummaryV2IsDefault = "analysisSummaryV2Default",
55
BuildModeOption = "buildModeOption",
6+
DatabaseInterpretResultsSupportsSarifRunProperty = "databaseInterpretResultsSupportsSarifRunProperty",
67
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
78
InformsAboutUnsupportedPathFilters = "informsAboutUnsupportedPathFilters",
89
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",

0 commit comments

Comments
 (0)