Skip to content

Commit

Permalink
DOP-4602: Add feature flag to conditionally show WIP locales (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
rayangler authored May 31, 2024
1 parent c436545 commit 5755558
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cdk-infra/lib/constructs/worker/worker-env-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ export class WorkerEnvConstruct extends Construct {
const jobCollection = StringParameter.valueFromLookup(this, `${ssmPrefix}/atlas/collections/job/queue`);
const gatsbyMarianUrl = StringParameter.valueFromLookup(this, `${ssmPrefix}/frontend/marian_url`);
const gatsbyEnableDarkMode = StringParameter.valueFromLookup(this, `${ssmPrefix}/frontend/enable_dark_mode`);
// Feature flag to render locales in the process of being translated. Might want to keep this while we continue to translate
// to new languages to avoid needing to keep moving this flag around
const gatsbyFeatureShowHiddenLocales = StringParameter.valueFromLookup(
this,
`${ssmPrefix}/flag/show_hidden_locales`
);

const dbPassword = secureStrings['MONGO_ATLAS_PASSWORD'];
this.environment = {
Expand Down Expand Up @@ -103,6 +109,7 @@ export class WorkerEnvConstruct extends Construct {
GATSBY_MARIAN_URL: gatsbyMarianUrl,
IS_FEATURE_BRANCH: getIsFeatureBranch(),
GATSBY_ENABLE_DARK_MODE: gatsbyEnableDarkMode,
GATSBY_FEATURE_SHOW_HIDDEN_LOCALES: gatsbyFeatureShowHiddenLocales,
};
}
}
1 change: 1 addition & 0 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"featureFlagUpdatePages": "FEATURE_FLAG_UPDATE_PAGES",
"featureFlagSearchUI": "GATSBY_TEST_SEARCH_UI",
"gatsbyHideUnifiedFooterLocale": "GATSBY_HIDE_UNIFIED_FOOTER_LOCALE",
"gatsbyFeatureShowHiddenLocales": "GATSBY_FEATURE_SHOW_HIDDEN_LOCALES",
"gatsbyMarianURL": "GATSBY_MARIAN_URL",
"repoBranchesCollection": "REPO_BRANCHES_COL_NAME",
"docsetsCollection": "DOCSETS_COL_NAME",
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/ecs-main/ecs_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Resources:
Value: ${self:custom.gatsbyMarianURL}
- Name: GATSBY_ENABLE_DARK_MODE
Value: ${self:custom.gatsbyEnableDarkMode}
- Name: GATSBY_FEATURE_SHOW_HIDDEN_LOCALES
Value: ${self:custom.gatsbyFeatureShowHiddenLocales}
- Name: GATSBY_HIDE_UNIFIED_FOOTER_LOCALE
Value: ${self:custom.gatsbyHideUnifiedFooterLocale}
- Name: FASTLY_MAIN_TOKEN
Expand Down
1 change: 1 addition & 0 deletions infrastructure/ecs-main/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ custom:
gatsbyHideUnifiedFooterLocale: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/hide_locale}
gatsbyMarianURL: ${ssm:/env/${self:provider.stage}/docs/worker_pool/frontend/marian_url}
gatsbyEnableDarkMode: ${ssm:/env/${self:provider.stage}/docs/worker_pool/frontend/enable_dark_mode}
gatsbyFeatureShowHiddenLocales: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/show_hidden_locales}
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}
Expand Down
1 change: 1 addition & 0 deletions src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ export abstract class JobHandler {
GATSBY_HIDE_UNIFIED_FOOTER_LOCALE: this._config.get<string>('gatsbyHideUnifiedFooterLocale'),
GATSBY_MARIAN_URL: this._config.get<string>('gatsbyMarianURL'),
GATSBY_ENABLE_DARK_MODE: this._config.get<string>('gatsbyEnableDarkMode'),
GATSBY_FEATURE_SHOW_HIDDEN_LOCALES: this._config.get<string>('gatsbyFeatureShowHiddenLocales'),
};

for (const [envName, envValue] of Object.entries(snootyFrontEndVars)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/data/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,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_HIDE_UNIFIED_FOOTER_LOCALE=true\nGATSBY_MARIAN_URL=test-url\nGATSBY_ENABLE_DARK_MODE=true\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_HIDE_UNIFIED_FOOTER_LOCALE=true\nGATSBY_MARIAN_URL=test-url\nGATSBY_ENABLE_DARK_MODE=true\nGATSBY_FEATURE_SHOW_HIDDEN_LOCALES=true\n`;
}

static getPathPrefixCases(): Array<any> {
Expand Down
1 change: 1 addition & 0 deletions tests/utils/jobHandlerTestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export class JobHandlerTestHelper {
.mockReturnValue(nextGenEntry);
this.config.get.calledWith('GATSBY_PARSER_USER').mockReturnValue('TestUser');
this.config.get.calledWith('gatsbyEnableDarkMode').mockReturnValue('true');
this.config.get.calledWith('gatsbyFeatureShowHiddenLocales').mockReturnValue('true');
this.jobCommandExecutor.execute.mockResolvedValue({ status: 'success', output: 'Great work', error: null });
}
}

0 comments on commit 5755558

Please sign in to comment.