From c29fca48a1257ee3e00e5e5a8d38bf394b46b0ab Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Mon, 21 Nov 2022 11:14:38 -0800 Subject: [PATCH 1/4] Cache feature flags on disk This will allow feature flags to be shared across steps in the same job, avoiding an error we saw earlier where the init action had the flag enabled, but the analyze step had it disabled. This uses the runner's temp folder to cache the flags file, which will stick around until the job completes. --- lib/analyze-action.js | 2 +- lib/analyze-action.js.map | 2 +- lib/feature-flags.js | 60 ++++++++++++++++++++++---- lib/feature-flags.js.map | 2 +- lib/feature-flags.test.js | 62 ++++++++++++++++++++++----- lib/feature-flags.test.js.map | 2 +- lib/init-action.js | 2 +- lib/init-action.js.map | 2 +- src/analyze-action.ts | 7 +++- src/feature-flags.test.ts | 77 +++++++++++++++++++++++++++++----- src/feature-flags.ts | 79 ++++++++++++++++++++++++++++++----- src/init-action.ts | 7 +++- 12 files changed, 255 insertions(+), 49 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index b7ab5295cc..cb0afbfb7f 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -155,7 +155,7 @@ async function run() { const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]); const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY")); const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); - const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, logger); + const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger); await runAutobuildIfLegacyGoWorkflow(config, logger); dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger); if (actionsUtil.getRequiredInput("skip-queries") !== "true") { diff --git a/lib/analyze-action.js.map b/lib/analyze-action.js.map index b64d19301f..993f6ddb86 100644 --- a/lib/analyze-action.js.map +++ b/lib/analyze-action.js.map @@ -1 +1 @@ -{"version":3,"file":"analyze-action.js","source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B,CACpB,SAAS,EACT,MAAM,EACN,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;SACH;aAAM;YACL,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;SACH;QAED,OAAO;KACR;IAED,IAAI,QAAQ,IAAI,YAAY,EAAE;QAC5B,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN;YACE,GAAG,QAAQ;YACX,GAAG,YAAY,CAAC,YAAY;SAC7B,EACD,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;KACH;SAAM,IAAI,QAAQ,EAAE;QACnB,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN,EAAE,GAAG,QAAQ,EAAE,EACf,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;KACH;SAAM;QACL,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;KACH;AACH,CAAC;AAEY,QAAA,UAAU,GAAG,GAAG,EAAE,CAAC;AAEhC,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,kBAAU,CAAC;KAClB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"analyze-action.js","sourceRoot":"","sources":["../src/analyze-action.ts"],"names":[],"mappings":";;;;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ACT,MAAM,EACN,KAAK,EACL,KAAK,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;SACH;aAAM;YACL,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;SACH;QAED,OAAO;KACR;IAED,IAAI,QAAQ,IAAI,YAAY,EAAE;QAC5B,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN;YACE,GAAG,QAAQ;YACX,GAAG,YAAY,CAAC,YAAY;SAC7B,EACD,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;KACH;SAAM,IAAI,QAAQ,EAAE;QACnB,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN,EAAE,GAAG,QAAQ,EAAE,EACf,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;KACH;SAAM;QACL,MAAM,gBAAgB,CACpB,SAAS,EACT,MAAM,EACN,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,CACP,CAAC;KACH;AACH,CAAC;AAEY,QAAA,UAAU,GAAG,GAAG,EAAE,CAAC;AAEhC,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,kBAAU,CAAC;KAClB;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/lib/feature-flags.js b/lib/feature-flags.js index 4f32ba742f..41c65ed644 100644 --- a/lib/feature-flags.js +++ b/lib/feature-flags.js @@ -19,7 +19,9 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Features = exports.featureConfig = exports.Feature = void 0; +exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = void 0; +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); const api_client_1 = require("./api-client"); const util = __importStar(require("./util")); var Feature; @@ -57,14 +59,15 @@ exports.featureConfig = { minimumVersion: undefined, }, }; +exports.FEATURE_FLAGS_FILE_NAME = "feature-flags.json"; /** * Determines the enablement status of a number of features. * If feature enablement is not able to be determined locally, a request to the * GitHub API is made to determine the enablement status. */ class Features { - constructor(gitHubVersion, repositoryNwo, logger) { - this.gitHubFeatureFlags = new GitHubFeatureFlags(gitHubVersion, repositoryNwo, logger); + constructor(gitHubVersion, repositoryNwo, tempDir, logger) { + this.gitHubFeatureFlags = new GitHubFeatureFlags(gitHubVersion, repositoryNwo, path.join(tempDir, exports.FEATURE_FLAGS_FILE_NAME), logger); } /** * @@ -108,14 +111,15 @@ class Features { } exports.Features = Features; class GitHubFeatureFlags { - constructor(gitHubVersion, repositoryNwo, logger) { + constructor(gitHubVersion, repositoryNwo, featureFlagsFile, logger) { this.gitHubVersion = gitHubVersion; this.repositoryNwo = repositoryNwo; + this.featureFlagsFile = featureFlagsFile; this.logger = logger; /**/ } async getValue(feature) { - const response = await this.getApiResponse(); + const response = await this.getAllFeatures(); if (response === undefined) { this.logger.debug(`No feature flags API response for ${feature}, considering it disabled.`); return false; @@ -127,10 +131,48 @@ class GitHubFeatureFlags { } return !!featureEnablement; } - async getApiResponse() { - const apiResponse = this.cachedApiResponse || (await this.loadApiResponse()); - this.cachedApiResponse = apiResponse; - return apiResponse; + async getAllFeatures() { + // if we have an in memory cache, use that + if (this.cachedApiResponse !== undefined) { + return this.cachedApiResponse; + } + // if a previous step has written a feature flags file to disk, use that + const fileFlags = await this.readLocalFlags(); + if (fileFlags !== undefined) { + this.cachedApiResponse = fileFlags; + return fileFlags; + } + // if not, request flags from the server + let remoteFlags = await this.loadApiResponse(); + if (remoteFlags === undefined) { + remoteFlags = {}; + } + // cache the response in memory + this.cachedApiResponse = remoteFlags; + // and cache them to disk so future workflow steps can use them + await this.writeLocalFlags(remoteFlags); + return remoteFlags; + } + async readLocalFlags() { + try { + if (fs.existsSync(this.featureFlagsFile)) { + this.logger.debug(`Loading feature flags from ${this.featureFlagsFile}`); + return JSON.parse(fs.readFileSync(this.featureFlagsFile, "utf8")); + } + } + catch (e) { + this.logger.warning(`Error reading cached feature flags file ${this.featureFlagsFile}: ${e}. Requesting from GitHub instead.`); + } + return undefined; + } + async writeLocalFlags(flags) { + try { + this.logger.debug(`Writing feature flags to ${this.featureFlagsFile}`); + fs.writeFileSync(this.featureFlagsFile, JSON.stringify(flags)); + } + catch (e) { + this.logger.warning(`Error writing cached feature flags file ${this.featureFlagsFile}: ${e}.`); + } } async loadApiResponse() { // Do nothing when not running against github.com diff --git a/lib/feature-flags.js.map b/lib/feature-flags.js.map index 5948a10ef4..369a86bb58 100644 --- a/lib/feature-flags.js.map +++ b/lib/feature-flags.js.map @@ -1 +1 @@ -{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../src/feature-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA4C;AAI5C,6CAA+B;AAM/B,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,8DAAmD,CAAA;IACnD,2DAAgD,CAAA;IAChD,2EAAgE,CAAA;IAChE,+EAAoE,CAAA;IACpE,iEAAsD,CAAA;IACtD,sDAA2C,CAAA;AAC7C,CAAC,EAPW,OAAO,GAAP,eAAO,KAAP,eAAO,QAOlB;AAEY,QAAA,aAAa,GAGtB;IACF,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;QAChC,MAAM,EAAE,yBAAyB;QACjC,cAAc,EAAE,SAAS;KAC1B;IACD,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE;QAC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QAC3D,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;QACrC,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,iDAAiD;QACjD,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,oEAAoE,CACrE,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAY,GAAE,CAAC,OAAO,CAC3C,8DAA8D,EAC9D;gBACE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC/B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;aAC9B,CACF,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,CACjB,gGAAgG;oBAC9F,oEAAoE;oBACpE,qFAAqF;oBACrF,kFAAkF,CAAC,EAAE,CACxF,CAAC;aACH;iBAAM;gBACL,kFAAkF;gBAClF,8EAA8E;gBAC9E,2FAA2F;gBAC3F,eAAe;gBACf,MAAM,IAAI,KAAK,CACb,sEAAsE,CAAC,EAAE,CAC1E,CAAC;aACH;SACF;IACH,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../src/feature-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,6CAA4C;AAI5C,6CAA+B;AAM/B,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,8DAAmD,CAAA;IACnD,2DAAgD,CAAA;IAChD,2EAAgE,CAAA;IAChE,+EAAoE,CAAA;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AAoE;oBACpE,qFAAqF;oBACrF,kFAAkF,CAAC,EAAE,CACxF,CAAC;aACH;iBAAM;gBACL,kFAAkF;gBAClF,8EAA8E;gBAC9E,2FAA2F;gBAC3F,eAAe;gBACf,MAAM,IAAI,KAAK,CACb,sEAAsE,CAAC,EAAE,CAC1E,CAAC;aACH;SACF;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/lib/feature-flags.test.js b/lib/feature-flags.test.js index d8600c71ac..49881e12af 100644 --- a/lib/feature-flags.test.js +++ b/lib/feature-flags.test.js @@ -1,8 +1,29 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); +const fs = __importStar(require("fs")); +const path = __importStar(require("path")); const ava_1 = __importDefault(require("ava")); const feature_flags_1 = require("./feature-flags"); const logging_1 = require("./logging"); @@ -25,7 +46,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { (0, ava_1.default)(`All features are disabled if running against ${variant.description}`, async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { const loggedMessages = []; - const featureEnablement = setUpTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages), variant.gitHubVersion); + const featureEnablement = setUpFeatureFlagTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages), variant.gitHubVersion); for (const feature of Object.values(feature_flags_1.Feature)) { t.false(await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))); } @@ -38,7 +59,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { (0, ava_1.default)("API response missing", async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { const loggedMessages = []; - const featureEnablement = setUpTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages)); + const featureEnablement = setUpFeatureFlagTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages)); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(403, {}); for (const feature of Object.values(feature_flags_1.Feature)) { t.assert((await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))) === false); @@ -49,7 +70,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { (0, ava_1.default)("Features are disabled if they're not returned in API response", async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { const loggedMessages = []; - const featureEnablement = setUpTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages)); + const featureEnablement = setUpFeatureFlagTests(tmpDir, (0, testing_utils_1.getRecordingLogger)(loggedMessages)); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, {}); for (const feature of Object.values(feature_flags_1.Feature)) { t.assert((await featureEnablement.getValue(feature, includeCodeQlIfRequired(feature))) === false); @@ -59,7 +80,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { }); (0, ava_1.default)("Feature flags exception is propagated if the API request errors", async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(500, {}); await t.throwsAsync(async () => featureEnablement.getValue(feature_flags_1.Feature.MlPoweredQueriesEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.MlPoweredQueriesEnabled)), { message: "Encountered an error while trying to determine feature enablement: Error: some error message", @@ -69,7 +90,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { for (const feature of Object.keys(feature_flags_1.featureConfig)) { (0, ava_1.default)(`Only feature '${feature}' is enabled if enabled in the API response. Other features disabled`, async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); // set all features to false except the one we're testing const expectedFeatureEnablement = {}; for (const f of Object.keys(feature_flags_1.featureConfig)) { @@ -87,7 +108,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) { }); (0, ava_1.default)(`Only feature '${feature}' is enabled if the associated environment variable is true. Others disabled.`, async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(false); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); // feature should be disabled initially @@ -99,7 +120,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) { }); (0, ava_1.default)(`Feature '${feature}' is disabled if the associated environment variable is false, even if enabled in API`, async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(true); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); // feature should be enabled initially @@ -112,7 +133,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) { if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) { (0, ava_1.default)(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(true); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); await t.throwsAsync(async () => featureEnablement.getValue(feature), { @@ -124,7 +145,7 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) { if (feature_flags_1.featureConfig[feature].minimumVersion !== undefined) { (0, ava_1.default)(`Feature '${feature}' is disabled if the minimum CLI version is below ${feature_flags_1.featureConfig[feature].minimumVersion}`, async (t) => { await (0, util_1.withTmpDir)(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(true); (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); // feature should be disabled when an old CLI version is set @@ -156,6 +177,25 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) { // An even less likely scenario is that we no longer have any features. t.assert(Object.values(feature_flags_1.featureConfig).length > 0, "There should be at least one feature"); }); +(0, ava_1.default)("Feature flags are saved to disk", async (t) => { + await (0, util_1.withTmpDir)(async (tmpDir) => { + const featureEnablement = setUpFeatureFlagTests(tmpDir); + const expectedFeatureEnablement = initializeFeatures(true); + (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); + const cachedFeatureFlags = path.join(tmpDir, feature_flags_1.FEATURE_FLAGS_FILE_NAME); + t.false(fs.existsSync(cachedFeatureFlags), "Feature flag cached file should not exist before getting feature flags"); + t.true(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled initially"); + t.true(fs.existsSync(cachedFeatureFlags), "Feature flag cached file should exist after getting feature flags"); + const actualFeatureEnablement = JSON.parse(fs.readFileSync(cachedFeatureFlags, "utf8")); + t.deepEqual(actualFeatureEnablement, expectedFeatureEnablement); + // now test that we actually use the feature flag cache instead of the server + actualFeatureEnablement[feature_flags_1.Feature.CliConfigFileEnabled] = false; + fs.writeFileSync(cachedFeatureFlags, JSON.stringify(actualFeatureEnablement)); + // delete the in memory cache so that we are forced to use the cached file + featureEnablement.gitHubFeatureFlags.cachedApiResponse = undefined; + t.false(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled after reading from cached file"); + }); +}); function assertAllFeaturesUndefinedInApi(t, loggedMessages) { for (const feature of Object.keys(feature_flags_1.featureConfig)) { t.assert(loggedMessages.find((v) => v.type === "debug" && @@ -169,9 +209,9 @@ function initializeFeatures(initialValue) { return features; }, {}); } -function setUpTests(tmpDir, logger = (0, logging_1.getRunnerLogger)(true), gitHubVersion = { type: util_1.GitHubVariant.DOTCOM }) { +function setUpFeatureFlagTests(tmpDir, logger = (0, logging_1.getRunnerLogger)(true), gitHubVersion = { type: util_1.GitHubVariant.DOTCOM }) { (0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir); - return new feature_flags_1.Features(gitHubVersion, testRepositoryNwo, logger); + return new feature_flags_1.Features(gitHubVersion, testRepositoryNwo, tmpDir, logger); } function includeCodeQlIfRequired(feature) { return feature_flags_1.featureConfig[feature].minimumVersion !== undefined diff --git a/lib/feature-flags.test.js.map b/lib/feature-flags.test.js.map index df5ce53c6f..03646438e0 100644 --- a/lib/feature-flags.test.js.map +++ b/lib/feature-flags.test.js.map @@ -1 +1 @@ -{"version":3,"file":"feature-flags.test.js","sourceRoot":"","sources":["../src/feature-flags.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAEvB,mDAKyB;AACzB,uCAA4C;AAC5C,6CAAkD;AAClD,mDAOyB;AAEzB,iCAA0E;AAE1E,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,IAAA,4BAAqB,EAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAA,+BAAkB,EAAC,gBAAgB,CAAC,CAAC;AAE/D,MAAM,8BA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CAAC,CAAC;IAEjC,OAAO,IAAI,wBAAQ,CAAC,aAAa,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAe;IAC9C,OAAO,6BAAa,CAAC,OAAO,CAAC,CAAC,cAAc,KAAK,SAAS;QACxD,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC;QAC5B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"} \ No newline at end of file +{"version":3,"file":"feature-flags.test.js","sourceRoot":"","sources":["../src/feature-flags.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,8CAAuB;AAEvB,mDAMyB;AACzB,uCAA4C;AAC5C,6CAAkD;AAClD,mDAOyB;AAEzB,iCAA0E;AAE1E,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,IAAA,4BAAqB,EAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAA,+BAAkB,EAAC,gBAAgB,CAAC,CAAC;AAE/D,MAAM,8BAA8B,GAG/B;IACH;QACE,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE;KAC9D;IACD,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,EAAE;CACrE,CAAC;AAEF,KAAK,MAAM,OAAO,IAAI,8BAA8B,EAAE;IACpD,IAAA,aAAI,EAAC,gDAAgD,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACtF,MAAM,IAAA,iBAAU,EAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChC,MAAM,cAAc,GAAG,EAAE,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,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/lib/init-action.js b/lib/init-action.js index 60e9a3d604..10931389d3 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88,7 +88,7 @@ async function run() { const gitHubVersion = await (0, api_client_1.getGitHubVersion)(); (0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger); const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY")); - const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, logger); + const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), logger); try { const workflowErrors = await (0, actions_util_1.validateWorkflow)(); if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "starting", startedAt, workflowErrors)))) { diff --git a/lib/init-action.js.map b/lib/init-action.js.map index 28cb75b70d..fc2a83b13f 100644 --- a/lib/init-action.js.map +++ b/lib/init-action.js.map @@ -1 +1 @@ -{"version":3,"file":"init-action.js","sourceRoot":"","sources":["../src/init-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,oDAAsC;AAEtC,iDASwB;AACxB,6CAAgD;AAChD,qCAA8D;AAE9D,mDAAuE;AACvE,iCAMgB;AAChB,2CAAuC;AACvC,uCAAqD;AACrD,6CAAkD;AAClD,iDAAmD;AACnD,iCAcgB;AAEhB,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AA+BvC,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,MAA0B,EAC1B,YAAoB,EACpB,MAAc;;IAEd,MAAM,gBAAgB,GAAG,MAAM,IAAA,qCAAsB,EACnD,MAAM,EACN,SAAS,EACT,SAAS,CACV,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,iBAAiB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,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"init-action.js","sourceRoot":"","sources":["../src/init-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,oDAAsC;AAEtC,iDASwB;AACxB,6CAAgD;AAChD,qCAA8D;AAE9D,mDAAuE;AACvE,iCAMgB;AAChB,2CAAuC;AACvC,uCAAqD;AACrD,6CAAkD;AAClD,iDAAmD;AACnD,iCAcgB;AAEhB,8CAA8C;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AA+BvC,KAAK,UAAU,uBAAuB,CACpC,SAAe,EACf,MAA0B,EAC1B,YAAoB,EACpB,MAAc;;IAEd,MAAM,gBAAgB,GAAG,MAAM,IAAA,qCAAsB,EACnD,MAAM,EACN,SAAS,EACT,SAAS,CACV,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,MAAM,iBAAiB,GAAG,IAAA,+BAAgB,EAAC,WAAW,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CACvE,GAAG,CACJ,CAAC;IACF,MAAM,qBAAqB,GAAG,MAAM,CAAC,iBAAiB,CACpD,yBAAyB,CAC1B;QACC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,YAAY,GAAG,MAAA,IAAA,+BAAgB,EAAC,SAAS,CAAC,0CAAE,IAAI,EAAE,CAAC;IACvD,IAAI,YAAY,KAAK,SAA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;IACD,MAAM,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AACzE,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,iBAAoC;IAEpC,0DAA0D;IAC1D,MAAM,WAAW,GAAG,IAAA,+BAAgB,EAAC,cAAc,CAAC,CAAC;IACrD,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,WAAW,KAAK,MAAM,CAAC;IAE7D,6FAA6F;IAC7F,IAAI,CAAC,IAAA,qBAAc,GAAE;QAAE,OAAO,KAAK,CAAC;IAEpC,8CAA8C;IAC9C,OAAO,MAAM,iBAAiB,CAAC,QAAQ,CAAC,uBAAO,CAAC,kBAAkB,CAAC,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;KACpB;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"} \ No newline at end of file diff --git a/src/analyze-action.ts b/src/analyze-action.ts index 79d95c4bdd..509d0cd91b 100644 --- a/src/analyze-action.ts +++ b/src/analyze-action.ts @@ -217,7 +217,12 @@ async function run() { const gitHubVersion = await getGitHubVersion(); - const features = new Features(gitHubVersion, repositoryNwo, logger); + const features = new Features( + gitHubVersion, + repositoryNwo, + actionsUtil.getTemporaryDirectory(), + logger + ); await runAutobuildIfLegacyGoWorkflow(config, logger); diff --git a/src/feature-flags.test.ts b/src/feature-flags.test.ts index af5f4d9650..f2739f316e 100644 --- a/src/feature-flags.test.ts +++ b/src/feature-flags.test.ts @@ -1,3 +1,6 @@ +import * as fs from "fs"; +import * as path from "path"; + import test from "ava"; import { @@ -5,6 +8,7 @@ import { featureConfig, FeatureEnablement, Features, + FEATURE_FLAGS_FILE_NAME, } from "./feature-flags"; import { getRunnerLogger } from "./logging"; import { parseRepositoryNwo } from "./repository"; @@ -42,7 +46,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { test(`All features are disabled if running against ${variant.description}`, async (t) => { await withTmpDir(async (tmpDir) => { const loggedMessages = []; - const featureEnablement = setUpTests( + const featureEnablement = setUpFeatureFlagTests( tmpDir, getRecordingLogger(loggedMessages), variant.gitHubVersion @@ -72,7 +76,7 @@ for (const variant of ALL_FEATURES_DISABLED_VARIANTS) { test("API response missing", async (t) => { await withTmpDir(async (tmpDir) => { const loggedMessages: LoggedMessage[] = []; - const featureEnablement = setUpTests( + const featureEnablement = setUpFeatureFlagTests( tmpDir, getRecordingLogger(loggedMessages) ); @@ -94,7 +98,7 @@ test("API response missing", async (t) => { test("Features are disabled if they're not returned in API response", async (t) => { await withTmpDir(async (tmpDir) => { const loggedMessages: LoggedMessage[] = []; - const featureEnablement = setUpTests( + const featureEnablement = setUpFeatureFlagTests( tmpDir, getRecordingLogger(loggedMessages) ); @@ -116,7 +120,7 @@ test("Features are disabled if they're not returned in API response", async (t) test("Feature flags exception is propagated if the API request errors", async (t) => { await withTmpDir(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); mockFeatureFlagApiEndpoint(500, {}); @@ -137,7 +141,7 @@ test("Feature flags exception is propagated if the API request errors", async (t for (const feature of Object.keys(featureConfig)) { test(`Only feature '${feature}' is enabled if enabled in the API response. Other features disabled`, async (t) => { await withTmpDir(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); // set all features to false except the one we're testing const expectedFeatureEnablement: { [feature: string]: boolean } = {}; @@ -162,7 +166,7 @@ for (const feature of Object.keys(featureConfig)) { test(`Only feature '${feature}' is enabled if the associated environment variable is true. Others disabled.`, async (t) => { await withTmpDir(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(false); mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement); @@ -188,7 +192,7 @@ for (const feature of Object.keys(featureConfig)) { test(`Feature '${feature}' is disabled if the associated environment variable is false, even if enabled in API`, async (t) => { await withTmpDir(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(true); mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement); @@ -215,7 +219,7 @@ for (const feature of Object.keys(featureConfig)) { if (featureConfig[feature].minimumVersion !== undefined) { test(`Getting feature '${feature} should throw if no codeql is provided`, async (t) => { await withTmpDir(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(true); mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement); @@ -233,7 +237,7 @@ for (const feature of Object.keys(featureConfig)) { if (featureConfig[feature].minimumVersion !== undefined) { test(`Feature '${feature}' is disabled if the minimum CLI version is below ${featureConfig[feature].minimumVersion}`, async (t) => { await withTmpDir(async (tmpDir) => { - const featureEnablement = setUpTests(tmpDir); + const featureEnablement = setUpFeatureFlagTests(tmpDir); const expectedFeatureEnablement = initializeFeatures(true); mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement); @@ -285,6 +289,57 @@ test("At least one feature has a minimum version specified", (t) => { ); }); +test("Feature flags are saved to disk", async (t) => { + await withTmpDir(async (tmpDir) => { + const featureEnablement = setUpFeatureFlagTests(tmpDir); + const expectedFeatureEnablement = initializeFeatures(true); + mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement); + + const cachedFeatureFlags = path.join(tmpDir, FEATURE_FLAGS_FILE_NAME); + + t.false( + fs.existsSync(cachedFeatureFlags), + "Feature flag cached file should not exist before getting feature flags" + ); + + t.true( + await featureEnablement.getValue( + Feature.CliConfigFileEnabled, + includeCodeQlIfRequired(Feature.CliConfigFileEnabled) + ), + "Feature flag should be enabled initially" + ); + + t.true( + fs.existsSync(cachedFeatureFlags), + "Feature flag cached file should exist after getting feature flags" + ); + + const actualFeatureEnablement = JSON.parse( + fs.readFileSync(cachedFeatureFlags, "utf8") + ); + t.deepEqual(actualFeatureEnablement, expectedFeatureEnablement); + + // now test that we actually use the feature flag cache instead of the server + actualFeatureEnablement[Feature.CliConfigFileEnabled] = false; + fs.writeFileSync( + cachedFeatureFlags, + JSON.stringify(actualFeatureEnablement) + ); + + // delete the in memory cache so that we are forced to use the cached file + (featureEnablement as any).gitHubFeatureFlags.cachedApiResponse = undefined; + + t.false( + await featureEnablement.getValue( + Feature.CliConfigFileEnabled, + includeCodeQlIfRequired(Feature.CliConfigFileEnabled) + ), + "Feature flag should be enabled after reading from cached file" + ); + }); +}); + function assertAllFeaturesUndefinedInApi(t, loggedMessages: LoggedMessage[]) { for (const feature of Object.keys(featureConfig)) { t.assert( @@ -305,14 +360,14 @@ function initializeFeatures(initialValue: boolean) { }, {}); } -function setUpTests( +function setUpFeatureFlagTests( tmpDir: string, logger = getRunnerLogger(true), gitHubVersion = { type: GitHubVariant.DOTCOM } as util.GitHubVersion ): FeatureEnablement { setupActionsVars(tmpDir, tmpDir); - return new Features(gitHubVersion, testRepositoryNwo, logger); + return new Features(gitHubVersion, testRepositoryNwo, tmpDir, logger); } function includeCodeQlIfRequired(feature: string) { diff --git a/src/feature-flags.ts b/src/feature-flags.ts index 029fa8a629..1204839ac3 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -1,3 +1,6 @@ +import * as fs from "fs"; +import * as path from "path"; + import { getApiClient } from "./api-client"; import { CodeQL } from "./codeql"; import { Logger } from "./logging"; @@ -55,6 +58,8 @@ export const featureConfig: Record< */ type GitHubFeatureFlagsApiResponse = Partial>; +export const FEATURE_FLAGS_FILE_NAME = "feature-flags.json"; + /** * Determines the enablement status of a number of features. * If feature enablement is not able to be determined locally, a request to the @@ -66,11 +71,13 @@ export class Features implements FeatureEnablement { constructor( gitHubVersion: util.GitHubVersion, repositoryNwo: RepositoryNwo, + tempDir: string, logger: Logger ) { this.gitHubFeatureFlags = new GitHubFeatureFlags( gitHubVersion, repositoryNwo, + path.join(tempDir, FEATURE_FLAGS_FILE_NAME), logger ); } @@ -120,7 +127,6 @@ export class Features implements FeatureEnablement { if (envVar === "true") { return true; } - // Ask the GitHub API if the feature is enabled. return await this.gitHubFeatureFlags.getValue(feature); } @@ -130,15 +136,16 @@ class GitHubFeatureFlags implements FeatureEnablement { private cachedApiResponse: GitHubFeatureFlagsApiResponse | undefined; constructor( - private gitHubVersion: util.GitHubVersion, - private repositoryNwo: RepositoryNwo, - private logger: Logger + private readonly gitHubVersion: util.GitHubVersion, + private readonly repositoryNwo: RepositoryNwo, + private readonly featureFlagsFile: string, + private readonly logger: Logger ) { /**/ } async getValue(feature: Feature): Promise { - const response = await this.getApiResponse(); + const response = await this.getAllFeatures(); if (response === undefined) { this.logger.debug( `No feature flags API response for ${feature}, considering it disabled.` @@ -155,11 +162,63 @@ class GitHubFeatureFlags implements FeatureEnablement { return !!featureEnablement; } - private async getApiResponse(): Promise { - const apiResponse = - this.cachedApiResponse || (await this.loadApiResponse()); - this.cachedApiResponse = apiResponse; - return apiResponse; + private async getAllFeatures(): Promise { + // if we have an in memory cache, use that + if (this.cachedApiResponse !== undefined) { + return this.cachedApiResponse; + } + + // if a previous step has written a feature flags file to disk, use that + const fileFlags = await this.readLocalFlags(); + if (fileFlags !== undefined) { + this.cachedApiResponse = fileFlags; + return fileFlags; + } + + // if not, request flags from the server + let remoteFlags = await this.loadApiResponse(); + if (remoteFlags === undefined) { + remoteFlags = {}; + } + + // cache the response in memory + this.cachedApiResponse = remoteFlags; + + // and cache them to disk so future workflow steps can use them + await this.writeLocalFlags(remoteFlags); + + return remoteFlags; + } + + private async readLocalFlags(): Promise< + GitHubFeatureFlagsApiResponse | undefined + > { + try { + if (fs.existsSync(this.featureFlagsFile)) { + this.logger.debug( + `Loading feature flags from ${this.featureFlagsFile}` + ); + return JSON.parse(fs.readFileSync(this.featureFlagsFile, "utf8")); + } + } catch (e) { + this.logger.warning( + `Error reading cached feature flags file ${this.featureFlagsFile}: ${e}. Requesting from GitHub instead.` + ); + } + return undefined; + } + + private async writeLocalFlags( + flags: GitHubFeatureFlagsApiResponse + ): Promise { + try { + this.logger.debug(`Writing feature flags to ${this.featureFlagsFile}`); + fs.writeFileSync(this.featureFlagsFile, JSON.stringify(flags)); + } catch (e) { + this.logger.warning( + `Error writing cached feature flags file ${this.featureFlagsFile}: ${e}.` + ); + } } private async loadApiResponse() { diff --git a/src/init-action.ts b/src/init-action.ts index 00e1d251e5..c08a522c42 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -158,7 +158,12 @@ async function run() { getRequiredEnvParam("GITHUB_REPOSITORY") ); - const features = new Features(gitHubVersion, repositoryNwo, logger); + const features = new Features( + gitHubVersion, + repositoryNwo, + getTemporaryDirectory(), + logger + ); try { const workflowErrors = await validateWorkflow(); From da75623c678eacdc6589fe62c680761c40ce3192 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Mon, 21 Nov 2022 11:19:34 -0800 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf408e51ca..e59d5404c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [UNRELEASED] -No user facing changes. +- Fixed a bug where some the `init` action and the `analyze` action would have different sets of experimental feature flags enabled. [#1384](https://github.com/github/codeql-action/pull/1384) ## 2.1.33 - 16 Nov 2022 From cfce1c4e19e1d6bf7217bc7a5b9875e566b9f07a Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Mon, 21 Nov 2022 13:42:32 -0800 Subject: [PATCH 3/4] Rename --- lib/feature-flags.js | 2 +- lib/feature-flags.js.map | 2 +- src/feature-flags.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/feature-flags.js b/lib/feature-flags.js index 41c65ed644..46c50cb3a6 100644 --- a/lib/feature-flags.js +++ b/lib/feature-flags.js @@ -59,7 +59,7 @@ exports.featureConfig = { minimumVersion: undefined, }, }; -exports.FEATURE_FLAGS_FILE_NAME = "feature-flags.json"; +exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json"; /** * Determines the enablement status of a number of features. * If feature enablement is not able to be determined locally, a request to the diff --git a/lib/feature-flags.js.map b/lib/feature-flags.js.map index 369a86bb58..e1654398f9 100644 --- a/lib/feature-flags.js.map +++ b/lib/feature-flags.js.map @@ -1 +1 @@ -{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../src/feature-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,6CAA4C;AAI5C,6CAA+B;AAM/B,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,8DAAmD,CAAA;IACnD,2DAAgD,CAAA;IAChD,2EAAgE,CAAA;IAChE,+EAAoE,CAAA;IACpE,iEAAsD,CAAA;IACtD,sDAA2C,CAAA;AAC7C,CAAC,EAPW,OAAO,GAAP,eAAO,KAAP,eAAO,QAOlB;AAEY,QAAA,aAAa,GAGtB;IACF,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;QAChC,MAAM,EAAE,yBAAyB;QACjC,cAAc,EAAE,SAAS;KAC1B;IACD,CAAC,OAAO,CAAC,4BAA4B,CAAC,EAAE;QACtC,MAAM,EAAE,gCAAgC;QACxC,cAAc,EAAE,SAAS;KAC1B;IACD,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE;QAC9B,MAAM,EAAE,2BAA2B;QACnC,cAAc,EAAE,QAAQ;KACzB;IACD,CAAC,OAAO,CAAC,8BAA8B,CAAC,EAAE;QACxC,MAAM,EAAE,kCAAkC;QAC1C,cAAc,EAAE,QA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C,IAAI,CAAC,gBAAgB,KAAK,CAAC,GAAG,CAC1E,CAAC;SACH;IACH,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,iDAAiD;QACjD,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,oEAAoE,CACrE,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAY,GAAE,CAAC,OAAO,CAC3C,8DAA8D,EAC9D;gBACE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;gBAC/B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;aAC9B,CACF,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,CAAC;SACtB;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,CACjB,gGAAgG;oBAC9F,oEAAoE;oBACpE,qFAAqF;oBACrF,kFAAkF,CAAC,EAAE,CACxF,CAAC;aACH;iBAAM;gBACL,kFAAkF;gBAClF,8EAA8E;gBAC9E,2FAA2F;gBAC3F,eAAe;gBACf,MAAM,IAAI,KAAK,CACb,sEAAsE,CAAC,EAAE,CAC1E,CAAC;aACH;SACF;IACH,CAAC;CACF"} \ No newline at end of file +{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../src/feature-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,6CAA4C;AAI5C,6CAA+B;AAM/B,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,8DAAmD,CAAA;IACnD,2DAAgD,CAAA;IAChD,2EAAgE,CAAA;IAChE,+EAAoE,CAAA;IACpE,iEAAs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,qFAAqF;oBACrF,kFAAkF,CAAC,EAAE,CACxF,CAAC;aACH;iBAAM;gBACL,kFAAkF;gBAClF,8EAA8E;gBAC9E,2FAA2F;gBAC3F,eAAe;gBACf,MAAM,IAAI,KAAK,CACb,sEAAsE,CAAC,EAAE,CAC1E,CAAC;aACH;SACF;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/src/feature-flags.ts b/src/feature-flags.ts index 1204839ac3..2ee6c62d36 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -58,7 +58,7 @@ export const featureConfig: Record< */ type GitHubFeatureFlagsApiResponse = Partial>; -export const FEATURE_FLAGS_FILE_NAME = "feature-flags.json"; +export const FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json"; /** * Determines the enablement status of a number of features. From 4ee97e5e55cee615b8fc64fc83f516ce8f80e7f4 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Mon, 21 Nov 2022 14:30:36 -0800 Subject: [PATCH 4/4] Add extra test ensuring env var overrides cached feature flag --- lib/feature-flags.test.js | 12 ++++++++++++ lib/feature-flags.test.js.map | 2 +- src/feature-flags.test.ts | 31 +++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/lib/feature-flags.test.js b/lib/feature-flags.test.js index 49881e12af..2be53499b8 100644 --- a/lib/feature-flags.test.js +++ b/lib/feature-flags.test.js @@ -196,6 +196,18 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) { t.false(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled after reading from cached file"); }); }); +(0, ava_1.default)("Environment variable can override feature flag cache", async (t) => { + await (0, util_1.withTmpDir)(async (tmpDir) => { + const featureEnablement = setUpFeatureFlagTests(tmpDir); + const expectedFeatureEnablement = initializeFeatures(true); + (0, testing_utils_1.mockFeatureFlagApiEndpoint)(200, expectedFeatureEnablement); + const cachedFeatureFlags = path.join(tmpDir, feature_flags_1.FEATURE_FLAGS_FILE_NAME); + t.true(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be enabled initially"); + t.true(fs.existsSync(cachedFeatureFlags), "Feature flag cached file should exist after getting feature flags"); + process.env.CODEQL_PASS_CONFIG_TO_CLI = "false"; + t.false(await featureEnablement.getValue(feature_flags_1.Feature.CliConfigFileEnabled, includeCodeQlIfRequired(feature_flags_1.Feature.CliConfigFileEnabled)), "Feature flag should be disabled after setting env var"); + }); +}); function assertAllFeaturesUndefinedInApi(t, loggedMessages) { for (const feature of Object.keys(feature_flags_1.featureConfig)) { t.assert(loggedMessages.find((v) => v.type === "debug" && diff --git a/lib/feature-flags.test.js.map b/lib/feature-flags.test.js.map index 03646438e0..79162b6382 100644 --- a/lib/feature-flags.test.js.map +++ b/lib/feature-flags.test.js.map @@ -1 +1 @@ -{"version":3,"file":"feature-flags.test.js","sourceRoot":"","sources":["../src/feature-flags.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,8CAAuB;AAEvB,mDAMyB;AACzB,uCAA4C;AAC5C,6CAAkD;AAClD,mDAOyB;AAEzB,iCAA0E;AAE1E,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,IAAA,4BAAqB,EAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAA,+BAAkB,EAAC,gBAAgB,CAAC,CAAC;AAE/D,MAAM,8BAA8B,GAG/B;IACH;QACE,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE;KAC9D;IACD,EAAE,WAAW,EAAE,MAAM,EAAE,aA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AAM,EAAE,MAAM,CAAC,CAAC;IAEjC,OAAO,IAAI,wBAAQ,CAAC,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAe;IAC9C,OAAO,6BAAa,CAAC,OAAO,CAAC,CAAC,cAAc,KAAK,SAAS;QACxD,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC;QAC5B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"} \ No newline at end of file +{"version":3,"file":"feature-flags.test.js","sourceRoot":"","sources":["../src/feature-flags.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,8CAAuB;AAEvB,mDAMyB;AACzB,uCAA4C;AAC5C,6CAAkD;AAClD,mDAOyB;AAEzB,iCAA0E;AAE1E,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,aAAI,CAAC,UAAU,CAAC,GAAG,EAAE;IACnB,IAAA,4BAAqB,EAAC,OAAO,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAA,+BAAkB,EAAC,gBAAgB,CAAC,CAAC;AAE/D,MAAM,8BAA8B,GAG/B;IACH;QACE,WAAW,EAAE,MAAM;QACnB,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE;KAC9D;IACD,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,oBAAa,CAAC,IAAI,EAAE,EAAE;CACrE,CAAC;AAEF,KAAK,MAAM,OAAO,IAAI,8BAA8B,EAAE;IACpD,IAAA,aAAI,EAAC,gDAAgD,OAAO,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACtF,MAAM,IAAA,iBAAU,EAAC,KAAK,EAAE,MAAM,EAAE,EAAE;Y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,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI,KAAK,OAAO;YACjB,CAAC,CAAC,OAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC;YACtC,CAAC,CAAC,OAAkB,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAC5D,KAAK,SAAS,CAChB,CAAC;KACH;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,YAAqB;IAC/C,OAAO,MAAM,CAAC,IAAI,CAAC,6BAAa,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;QACzD,QAAQ,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;QAC7B,OAAO,QAAQ,CAAC;IAClB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,SAAS,qBAAqB,CAC5B,MAAc,EACd,MAAM,GAAG,IAAA,yBAAe,EAAC,IAAI,CAAC,EAC9B,gBAAgB,EAAE,IAAI,EAAE,oBAAa,CAAC,MAAM,EAAwB;IAEpE,IAAA,gCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,OAAO,IAAI,wBAAQ,CAAC,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAe;IAC9C,OAAO,6BAAa,CAAC,OAAO,CAAC,CAAC,cAAc,KAAK,SAAS;QACxD,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC;QAC5B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/src/feature-flags.test.ts b/src/feature-flags.test.ts index f2739f316e..c4e0f326c2 100644 --- a/src/feature-flags.test.ts +++ b/src/feature-flags.test.ts @@ -340,6 +340,37 @@ test("Feature flags are saved to disk", async (t) => { }); }); +test("Environment variable can override feature flag cache", async (t) => { + await withTmpDir(async (tmpDir) => { + const featureEnablement = setUpFeatureFlagTests(tmpDir); + const expectedFeatureEnablement = initializeFeatures(true); + mockFeatureFlagApiEndpoint(200, expectedFeatureEnablement); + + const cachedFeatureFlags = path.join(tmpDir, FEATURE_FLAGS_FILE_NAME); + t.true( + await featureEnablement.getValue( + Feature.CliConfigFileEnabled, + includeCodeQlIfRequired(Feature.CliConfigFileEnabled) + ), + "Feature flag should be enabled initially" + ); + + t.true( + fs.existsSync(cachedFeatureFlags), + "Feature flag cached file should exist after getting feature flags" + ); + process.env.CODEQL_PASS_CONFIG_TO_CLI = "false"; + + t.false( + await featureEnablement.getValue( + Feature.CliConfigFileEnabled, + includeCodeQlIfRequired(Feature.CliConfigFileEnabled) + ), + "Feature flag should be disabled after setting env var" + ); + }); +}); + function assertAllFeaturesUndefinedInApi(t, loggedMessages: LoggedMessage[]) { for (const feature of Object.keys(featureConfig)) { t.assert(