Skip to content

Commit

Permalink
Add standard tools URLs to status report
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Sep 5, 2024
1 parent 3b0aa30 commit 0aafba9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/setup-codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lib/setup-codeql.test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.test.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/setup-codeql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
compressionMethod: "gzip",
downloadDurationMs: 200,
extractionDurationMs: 300,
toolsUrl: "toolsUrl",
},
toolsVersion: LINKED_CLI_VERSION.cliVersion,
});
Expand Down Expand Up @@ -204,6 +205,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
compressionMethod: "gzip",
downloadDurationMs: 200,
extractionDurationMs: 300,
toolsUrl: bundleUrl,
},
toolsVersion: expectedVersion,
});
Expand Down
11 changes: 11 additions & 0 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ export interface ToolsDownloadStatusReport {
compressionMethod: tar.CompressionMethod;
downloadDurationMs: number;
extractionDurationMs: number;
toolsUrl: string;
}

// Exported using `export const` for testing purposes. Specifically, we want to
Expand Down Expand Up @@ -553,6 +554,7 @@ export const downloadCodeQL = async function (
compressionMethod,
downloadDurationMs,
extractionDurationMs,
toolsUrl: sanitizeUrlForStatusReport(codeqlURL),
},
toolsVersion: maybeCliVersion ?? "unknown",
};
Expand Down Expand Up @@ -585,6 +587,7 @@ export const downloadCodeQL = async function (
compressionMethod,
downloadDurationMs,
extractionDurationMs,
toolsUrl: sanitizeUrlForStatusReport(codeqlURL),
},
toolsVersion: maybeCliVersion ?? toolcacheVersion,
};
Expand Down Expand Up @@ -711,3 +714,11 @@ async function cleanUpGlob(glob: string, name: string, logger: Logger) {
logger.warning(`Failed to clean up ${name}: ${e}.`);
}
}

function sanitizeUrlForStatusReport(url: string): string {
return ["github/codeql-action", "dsp-testing/codeql-cli-nightlies"].some(
(repo) => url.startsWith(`https://github.com/${repo}/releases/download/`),
)
? url
: "sanitized-value";
}

0 comments on commit 0aafba9

Please sign in to comment.