Add the feature to bypass the toolcache for kotlin and swift

This works by moving the logic to check for toolcache bypass out of
creating the codeql instance. The logic now _may_ perform an API request
in order to check what languages are in the repository. This check is
redundant because the same call is being made later in the action when
the actual list of languages is calculated.
This commit is contained in:
Andrew Eisenberg committed 2022-11-23 15:11:20 -08:00
1 parent 5b7c9daecd
commit f79028af27
27 files changed
+471 -78

No files matched your search

+7 -9
View File
@@ -14,7 +14,7 @@ import { GitHubApiDetails } from "./api-client";
import * as codeql from "./codeql";
import { AugmentationProperties, Config } from "./config-utils";
import * as defaults from "./defaults.json";
import { Feature, FeatureEnablement } from "./feature-flags";
import { Feature } from "./feature-flags";
import { Language } from "./languages";
import { getRunnerLogger } from "./logging";
import { setupTests, setupActionsVars, createFeatures } from "./testing-utils";
@@ -70,14 +70,14 @@ test.beforeEach(() => {
async function mockApiAndSetupCodeQL({
apiDetails,
featureEnablement,
bypassToolcache,
isPinned,
tmpDir,
toolsInput,
version,
}: {
apiDetails?: GitHubApiDetails;
featureEnablement?: FeatureEnablement;
bypassToolcache?: boolean;
isPinned?: boolean;
tmpDir: string;
toolsInput?: { input?: string };
@@ -110,7 +110,7 @@ async function mockApiAndSetupCodeQL({
apiDetails ?? sampleApiDetails,
tmpDir,
util.GitHubVariant.DOTCOM,
featureEnablement ?? createFeatures([]),
!!bypassToolcache,
getRunnerLogger(true),
false
);
@@ -173,7 +173,7 @@ test("don't download codeql bundle cache with pinned different version cached",
sampleApiDetails,
tmpDir,
util.GitHubVariant.DOTCOM,
createFeatures([]),
false,
getRunnerLogger(true),
false
);
@@ -281,9 +281,7 @@ for (const [
await mockApiAndSetupCodeQL({
version: defaults.bundleVersion,
apiDetails: sampleApiDetails,
featureEnablement: createFeatures(
isFeatureEnabled ? [Feature.BypassToolcacheEnabled] : []
),
bypassToolcache: isFeatureEnabled,
toolsInput: { input: toolsInput },
tmpDir,
});
@@ -339,7 +337,7 @@ test("download codeql bundle from github ae endpoint", async (t) => {
sampleGHAEApiDetails,
tmpDir,
util.GitHubVariant.GHAE,
createFeatures([]),
false,
getRunnerLogger(true),
false
);