mirror of
https://github.com/github/codeql-action.git
synced 2026-10-21 02:01:27 +00:00
Include apiDetails in CodeQLDownloadSource
This commit is contained in:
19
lib/entry-points.js
generated
19
lib/entry-points.js
generated
@@ -176641,7 +176641,8 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, rawLanguages, othe
|
||||
cliVersion: cliVersion2,
|
||||
compressionMethod,
|
||||
sourceType: "download",
|
||||
toolsVersion: resolvedVersion ?? "unknown"
|
||||
toolsVersion: resolvedVersion ?? "unknown",
|
||||
apiDetails
|
||||
};
|
||||
}
|
||||
async function tryGetFallbackToolcacheVersion(cliVersion2, tagName, logger2) {
|
||||
@@ -176655,7 +176656,7 @@ async function tryGetFallbackToolcacheVersion(cliVersion2, tagName, logger2) {
|
||||
);
|
||||
return fallbackVersion;
|
||||
}
|
||||
var downloadCodeQL = async function(source, apiDetails, tarVersion, tempDir, logger2) {
|
||||
var downloadCodeQL = async function(source, tarVersion, tempDir, logger2) {
|
||||
const { bundle, compressionMethod } = source;
|
||||
const codeqlURL = bundle.url;
|
||||
const parsedCodeQLURL = new URL(codeqlURL);
|
||||
@@ -176669,7 +176670,7 @@ var downloadCodeQL = async function(source, apiDetails, tarVersion, tempDir, log
|
||||
} else {
|
||||
authorization = getAuthorizationHeaderFor(
|
||||
logger2,
|
||||
apiDetails,
|
||||
source.apiDetails,
|
||||
codeqlURL
|
||||
);
|
||||
}
|
||||
@@ -176793,7 +176794,6 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
||||
const result = await downloadCodeQLBundle(
|
||||
{ env: getEnv(), features, logger: logger2 },
|
||||
source,
|
||||
apiDetails,
|
||||
zstdAvailability.version,
|
||||
tempDir
|
||||
);
|
||||
@@ -176813,19 +176813,13 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
||||
toolsVersion: source.toolsVersion
|
||||
};
|
||||
}
|
||||
async function downloadCodeQLBundle(action, source, apiDetails, tarVersion, tempDir) {
|
||||
async function downloadCodeQLBundle(action, source, tarVersion, tempDir) {
|
||||
const { bundle } = source;
|
||||
const { logger: logger2 } = action;
|
||||
await tryDeleteToolcacheBundles(action);
|
||||
const startTime = import_perf_hooks4.performance.now();
|
||||
try {
|
||||
return await downloadCodeQL(
|
||||
source,
|
||||
apiDetails,
|
||||
tarVersion,
|
||||
tempDir,
|
||||
logger2
|
||||
);
|
||||
return await downloadCodeQL(source, tarVersion, tempDir, logger2);
|
||||
} catch (e) {
|
||||
if (bundle.kind !== "per-language" || bundle.combinedBundleURL === void 0 || asHTTPError(e)?.status !== 404) {
|
||||
throw e;
|
||||
@@ -176836,7 +176830,6 @@ async function downloadCodeQLBundle(action, source, apiDetails, tarVersion, temp
|
||||
...source,
|
||||
bundle: { kind: "combined", url: bundle.combinedBundleURL }
|
||||
},
|
||||
apiDetails,
|
||||
tarVersion,
|
||||
tempDir,
|
||||
logger2
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { GitHubApiDetails } from "./github";
|
||||
import { BuiltInLanguage, parseBuiltInLanguage } from "./languages";
|
||||
import { BundlePlatform } from "./platform";
|
||||
import type { CompressionMethod } from "./tar";
|
||||
@@ -17,6 +18,8 @@ export type CodeQLBundle =
|
||||
export interface CodeQLDownloadSource {
|
||||
/** Distinguishes downloads from local archives and cached installations. */
|
||||
sourceType: "download";
|
||||
/** Information about the GitHub instance that contains the asset. */
|
||||
apiDetails: GitHubApiDetails;
|
||||
/** The bundle to download. */
|
||||
bundle: CodeQLBundle;
|
||||
/** The compression format of the bundle archive. */
|
||||
|
||||
@@ -156,6 +156,7 @@ test.serial(
|
||||
compressionMethod: "gzip",
|
||||
sourceType: "download",
|
||||
toolsVersion: "1.2.3",
|
||||
apiDetails: SAMPLE_DOTCOM_API_DETAILS,
|
||||
} satisfies setupCodeql.CodeQLDownloadSource);
|
||||
});
|
||||
},
|
||||
@@ -435,6 +436,7 @@ test.serial(
|
||||
compressionMethod: "zstd",
|
||||
sourceType: "download",
|
||||
toolsVersion: expectedVersion,
|
||||
apiDetails: SAMPLE_DOTCOM_API_DETAILS,
|
||||
} satisfies setupCodeql.CodeQLToolsSource);
|
||||
|
||||
const result = await setupCodeql.setupCodeQLBundle(
|
||||
@@ -508,6 +510,7 @@ test.serial(
|
||||
compressionMethod: "zstd",
|
||||
sourceType: "download",
|
||||
toolsVersion: expectedVersion,
|
||||
apiDetails: SAMPLE_DOTCOM_API_DETAILS,
|
||||
} satisfies setupCodeql.CodeQLToolsSource);
|
||||
|
||||
// Afterwards, ensure that we see the expected messages in the log.
|
||||
@@ -655,6 +658,7 @@ for (const toolsInput of ["nightly", "nightly-latest"]) {
|
||||
cliVersion: undefined,
|
||||
compressionMethod: "zstd",
|
||||
toolsVersion: "0.0.0-30260213",
|
||||
apiDetails: SAMPLE_DOTCOM_API_DETAILS,
|
||||
} satisfies setupCodeql.CodeQLDownloadSource);
|
||||
t.true(latestNightlyRequest.calledOnce);
|
||||
});
|
||||
@@ -807,6 +811,7 @@ for (const date of ["20200101", "30260213"]) {
|
||||
cliVersion: undefined,
|
||||
compressionMethod: "zstd",
|
||||
toolsVersion: `0.0.0-${date}`,
|
||||
apiDetails: SAMPLE_DOTCOM_API_DETAILS,
|
||||
} satisfies setupCodeql.CodeQLDownloadSource);
|
||||
|
||||
await t.throwsAsync(
|
||||
@@ -1864,8 +1869,8 @@ async function runDownloadCodeQL(
|
||||
cliVersion: CLEANUP_CLI_VERSION,
|
||||
sourceType: "download",
|
||||
toolsVersion: CLEANUP_CLI_VERSION,
|
||||
apiDetails: SAMPLE_DOTCOM_API_DETAILS,
|
||||
},
|
||||
SAMPLE_DOTCOM_API_DETAILS,
|
||||
undefined, // tarVersion
|
||||
toolcacheRoot, // tempDir
|
||||
);
|
||||
|
||||
@@ -718,6 +718,7 @@ export async function getCodeQLSource(
|
||||
compressionMethod,
|
||||
sourceType: "download",
|
||||
toolsVersion: resolvedVersion ?? "unknown",
|
||||
apiDetails,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -746,7 +747,6 @@ async function tryGetFallbackToolcacheVersion(
|
||||
// be able to stub this function and have other functions in this file use that stub.
|
||||
export const downloadCodeQL = async function (
|
||||
source: CodeQLDownloadSource,
|
||||
apiDetails: api.GitHubApiDetails,
|
||||
tarVersion: tar.TarVersion | undefined,
|
||||
tempDir: string,
|
||||
logger: Logger,
|
||||
@@ -769,7 +769,7 @@ export const downloadCodeQL = async function (
|
||||
} else {
|
||||
authorization = api.getAuthorizationHeaderFor(
|
||||
logger,
|
||||
apiDetails,
|
||||
source.apiDetails,
|
||||
codeqlURL,
|
||||
);
|
||||
}
|
||||
@@ -985,7 +985,6 @@ export async function setupCodeQLBundle(
|
||||
const result = await downloadCodeQLBundle(
|
||||
{ env: getEnv(), features, logger },
|
||||
source,
|
||||
apiDetails,
|
||||
zstdAvailability.version,
|
||||
tempDir,
|
||||
);
|
||||
@@ -1021,7 +1020,6 @@ export async function setupCodeQLBundle(
|
||||
export async function downloadCodeQLBundle(
|
||||
action: ActionState<["Logger", "ReadOnlyEnv", "FeatureFlags"]>,
|
||||
source: CodeQLDownloadSource,
|
||||
apiDetails: api.GitHubApiDetails,
|
||||
tarVersion: tar.TarVersion | undefined,
|
||||
tempDir: string,
|
||||
): Promise<{
|
||||
@@ -1035,13 +1033,7 @@ export async function downloadCodeQLBundle(
|
||||
|
||||
const startTime = performance.now();
|
||||
try {
|
||||
return await downloadCodeQL(
|
||||
source,
|
||||
apiDetails,
|
||||
tarVersion,
|
||||
tempDir,
|
||||
logger,
|
||||
);
|
||||
return await downloadCodeQL(source, tarVersion, tempDir, logger);
|
||||
} catch (e) {
|
||||
if (
|
||||
bundle.kind !== "per-language" ||
|
||||
@@ -1057,7 +1049,6 @@ export async function downloadCodeQLBundle(
|
||||
...source,
|
||||
bundle: { kind: "combined", url: bundle.combinedBundleURL },
|
||||
},
|
||||
apiDetails,
|
||||
tarVersion,
|
||||
tempDir,
|
||||
logger,
|
||||
|
||||
Reference in New Issue
Block a user