Introduce TRAP caching

This commit is contained in:
Edoardo Pirovano 2022-08-02 17:52:22 +01:00
parent cade2b5621
commit 8f867dcb21
No known key found for this signature in database
GPG key ID: 047556B5D93FFE28
52 changed files with 923 additions and 69 deletions

View file

@ -15,7 +15,7 @@ import {
import { getGitHubVersionActionsOnly } from "./api-client";
import { CodeQL, CODEQL_VERSION_NEW_TRACING } from "./codeql";
import * as configUtils from "./config-utils";
import { GitHubFeatureFlags } from "./feature-flags";
import { FeatureFlag, FeatureFlags, GitHubFeatureFlags } from "./feature-flags";
import {
initCodeQL,
initConfig,
@ -27,18 +27,18 @@ import { Language } from "./languages";
import { getActionsLogger } from "./logging";
import { parseRepositoryNwo } from "./repository";
import {
getRequiredEnvParam,
initializeEnvironment,
Mode,
checkActionVersion,
checkGitHubVersionInRange,
codeQlVersionAbove,
enrichEnvironment,
getMemoryFlagValue,
getThreadsFlagValue,
DEFAULT_DEBUG_ARTIFACT_NAME,
DEFAULT_DEBUG_DATABASE_NAME,
enrichEnvironment,
getMemoryFlagValue,
getMlPoweredJsQueriesStatus,
checkActionVersion,
getRequiredEnvParam,
getThreadsFlagValue,
initializeEnvironment,
Mode,
} from "./util";
// eslint-disable-next-line import/no-commonjs
@ -183,6 +183,7 @@ async function run() {
getOptionalInput("packs"),
getOptionalInput("config-file"),
getOptionalInput("db-location"),
await getTrapCachingEnabled(featureFlags),
// Debug mode is enabled if:
// - The `init` Action is passed `debug: true`.
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
@ -299,6 +300,13 @@ async function run() {
await sendSuccessStatusReport(startedAt, config, toolsVersion);
}
function getTrapCachingEnabled(featureFlags: FeatureFlags): Promise<boolean> {
const trapCaching = getOptionalInput("trap-caching");
if (trapCaching !== undefined)
return Promise.resolve(trapCaching.toLowerCase() === "true");
return featureFlags.getValue(FeatureFlag.TrapCachingEnabled);
}
async function runWrapper() {
try {
await run();