Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standard tools URLs to status report #2464

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
}
Loading