From 12fbb1666db35c41fca0dc189c97829b3e10e689 Mon Sep 17 00:00:00 2001 From: Caesar Bell Date: Tue, 3 Oct 2023 11:22:25 -0400 Subject: [PATCH] :triangular_flag_on_post: DOP-4060 adds new featrue flag to the docs-worker-pool (#919) * :triangular_flag_on_post: DOP-4060 adds new featrue flag to the docs-worker-pool * :triangular_flag_on_post: DOP-4060 adds new featrue flag to the docs-worker-pool * :ok_hand: DOP-4060 updated the way we are handling env vars based on feedback --------- Co-authored-by: Caesar Bell --- cdk-infra/lib/constructs/worker/worker-env-construct.ts | 4 ++++ infrastructure/ecs-main/ecs_service.yml | 2 ++ infrastructure/ecs-main/serverless.yml | 1 + src/job/jobHandler.ts | 1 + tests/data/data.ts | 2 +- tests/unit/job/productionJobHandler.test.ts | 2 +- tests/utils/jobHandlerTestHelper.ts | 1 + 7 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cdk-infra/lib/constructs/worker/worker-env-construct.ts b/cdk-infra/lib/constructs/worker/worker-env-construct.ts index a0313e3bb..ec439118f 100644 --- a/cdk-infra/lib/constructs/worker/worker-env-construct.ts +++ b/cdk-infra/lib/constructs/worker/worker-env-construct.ts @@ -36,6 +36,9 @@ export class WorkerEnvConstruct extends Construct { `/docs/worker_pool/preview_webhook/snooty_gatsby_cloud_test/data_source` ); + // font-end feature flag for unified footer locale selector + const gatsbyHideUnifiedFooterLocale = StringParameter.valueFromLookup(this, `${ssmPrefix}/flag/hide_locale`); + // front end feature flag for chatbot UI const gatsbyUseChatbot = StringParameter.valueFromLookup(this, `${ssmPrefix}/flag/use_chatbot`); @@ -86,6 +89,7 @@ export class WorkerEnvConstruct extends Construct { FEATURE_NAME: `${getFeatureName()}`, GATSBY_TEST_SEARCH_UI: 'false', GATSBY_SHOW_CHATBOT: gatsbyUseChatbot, + GATSBY_HIDE_UNIFIED_FOOTER_LOCALE: gatsbyHideUnifiedFooterLocale, }; } } diff --git a/infrastructure/ecs-main/ecs_service.yml b/infrastructure/ecs-main/ecs_service.yml index 6fc767800..de1422758 100644 --- a/infrastructure/ecs-main/ecs_service.yml +++ b/infrastructure/ecs-main/ecs_service.yml @@ -66,6 +66,8 @@ Resources: Value: ${self:custom.featureFlagSearchUI} - Name: GATSBY_SHOW_CHATBOT Value: ${self:custom.gatsbyUseChatbot} + - Name: GATSBY_HIDE_UNIFIED_FOOTER_LOCALE + Value: ${self:custom.gatsbyHideUnifiedFooterLocale} - Name: FASTLY_MAIN_TOKEN Value: ${self:custom.fastlyMainToken} - Name: FASTLY_MAIN_SERVICE_ID diff --git a/infrastructure/ecs-main/serverless.yml b/infrastructure/ecs-main/serverless.yml index c73430fbc..9a55255f7 100644 --- a/infrastructure/ecs-main/serverless.yml +++ b/infrastructure/ecs-main/serverless.yml @@ -118,6 +118,7 @@ custom: featureFlagSearchUI: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/search_ui} gatsbyTestEmbedVersions: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/embedded_versions} gatsbyUseChatbot: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/use_chatbot} + gatsbyHideUnifiedFooterLocale: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/hide_locale} fastlyMainToken: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/main/token} fastlyMainServiceId: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/main/service_id} fastlyCloudManagerToken: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/cloudmanager/token} diff --git a/src/job/jobHandler.ts b/src/job/jobHandler.ts index aa5fbbfaa..7e4b9a27c 100644 --- a/src/job/jobHandler.ts +++ b/src/job/jobHandler.ts @@ -374,6 +374,7 @@ export abstract class JobHandler { PREVIEW_BUILD_ENABLED: this._config.get('previewBuildEnabled'), GATSBY_TEST_SEARCH_UI: this._config.get('featureFlagSearchUI'), GATSBY_SHOW_CHATBOT: this._config.get('gatsbyUseChatbot'), + GATSBY_HIDE_UNIFIED_FOOTER_LOCALE: process.env.GATSBY_HIDE_UNIFIED_FOOTER_LOCALE || 'true', }; for (const [envName, envValue] of Object.entries(snootyFrontEndVars)) { diff --git a/tests/data/data.ts b/tests/data/data.ts index 396884a7f..595d1d97a 100644 --- a/tests/data/data.ts +++ b/tests/data/data.ts @@ -175,7 +175,7 @@ export class TestDataProvider { } static getEnvVarsWithPathPrefixWithFlags(job: Job): string { - return `GATSBY_PARSER_USER=TestUser\nGATSBY_PARSER_BRANCH=${job.payload.branchName}\nPATH_PREFIX=${job.payload.pathPrefix}\nGATSBY_BASE_URL=test\nPREVIEW_BUILD_ENABLED=false\nGATSBY_TEST_SEARCH_UI=false\nGATSBY_SHOW_CHATBOT=false\n`; + return `GATSBY_PARSER_USER=TestUser\nGATSBY_PARSER_BRANCH=${job.payload.branchName}\nPATH_PREFIX=${job.payload.pathPrefix}\nGATSBY_BASE_URL=test\nPREVIEW_BUILD_ENABLED=false\nGATSBY_TEST_SEARCH_UI=false\nGATSBY_SHOW_CHATBOT=false\nGATSBY_HIDE_UNIFIED_FOOTER_LOCALE=true\n`; } static getPathPrefixCases(): Array { diff --git a/tests/unit/job/productionJobHandler.test.ts b/tests/unit/job/productionJobHandler.test.ts index 0e788b611..b6934df7f 100644 --- a/tests/unit/job/productionJobHandler.test.ts +++ b/tests/unit/job/productionJobHandler.test.ts @@ -247,7 +247,7 @@ describe('ProductionJobHandler Tests', () => { expect(jobHandlerTestHelper.fileSystemServices.writeToFile).toBeCalledWith( `repos/${jobHandlerTestHelper.job.payload.repoName}/.env.production`, - `GATSBY_PARSER_USER=TestUser\nGATSBY_PARSER_BRANCH=${jobHandlerTestHelper.job.payload.branchName}\nPATH_PREFIX=/\nGATSBY_BASE_URL=test\nPREVIEW_BUILD_ENABLED=false\nGATSBY_TEST_SEARCH_UI=false\nGATSBY_SHOW_CHATBOT=false\n`, + `GATSBY_PARSER_USER=TestUser\nGATSBY_PARSER_BRANCH=${jobHandlerTestHelper.job.payload.branchName}\nPATH_PREFIX=/\nGATSBY_BASE_URL=test\nPREVIEW_BUILD_ENABLED=false\nGATSBY_TEST_SEARCH_UI=false\nGATSBY_SHOW_CHATBOT=false\nGATSBY_HIDE_UNIFIED_FOOTER_LOCALE=true\n`, { encoding: 'utf8', flag: 'w' } ); }); diff --git a/tests/utils/jobHandlerTestHelper.ts b/tests/utils/jobHandlerTestHelper.ts index 2e5669f1d..3a0c223b2 100644 --- a/tests/utils/jobHandlerTestHelper.ts +++ b/tests/utils/jobHandlerTestHelper.ts @@ -153,6 +153,7 @@ export class JobHandlerTestHelper { this.config.get.calledWith('previewBuildEnabled').mockReturnValue('false'); this.config.get.calledWith('featureFlagSearchUI').mockReturnValue('false'); this.config.get.calledWith('gatsbyUseChatbot').mockReturnValue('false'); + this.config.get.calledWith('gatsbyHideUnifiedFooterLocale').mockReturnValue('true'); this.repoConnector.checkCommits .calledWith(this.job) .mockReturnValue(TestDataProvider.getCommitCheckValidResponse(this.job));