Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOP-3994: add feature flag for chatbot #905

Merged
merged 7 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cdk-infra/lib/constructs/worker/worker-env-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class WorkerEnvConstruct extends Construct {
`/docs/worker_pool/preview_webhook/snooty_gatsby_cloud_test/data_source`
);

// front end feature flag for chatbot UI
const gatsbyUseChatbot = StringParameter.valueFromLookup(this, `${ssmPrefix}/flag/use_chatbot`);

const githubBotUsername = StringParameter.valueFromLookup(this, `${ssmPrefix}/github/bot/username`);

const npmEmail = StringParameter.valueFromLookup(this, `${ssmPrefix}/npm/email`);
Expand Down Expand Up @@ -80,6 +83,7 @@ export class WorkerEnvConstruct extends Construct {
USE_CUSTOM_BUCKETS: `${getUseCustomBuckets()}`,
FEATURE_NAME: `${getFeatureName()}`,
GATSBY_TEST_SEARCH_UI: 'false',
GATSBY_SHOW_CHATBOT: gatsbyUseChatbot,
};
}
}
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 @@
"previewBuildEnabled": "PREVIEW_BUILD_ENABLED",
"featureFlagUpdatePages": "FEATURE_FLAG_UPDATE_PAGES",
"featureFlagSearchUI": "GATSBY_TEST_SEARCH_UI",
"gatsbyUseChatbot": "GATSBY_SHOW_CHATBOT",
"repoBranchesCollection": "REPO_BRANCHES_COL_NAME",
"repo_dir": "repos",
"jobId": "jobId",
Expand Down
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"previewBuildEnabled": "false",
"featureFlagUpdatePages": "false",
"featureFlagSearchUI": "false",
"gatsbyUseChatbot": "false",
"parallel": {
"enabled": true,
"stg": {
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 @@ -62,6 +62,8 @@ Resources:
Value: ${self:custom.featureFlagUpdatePages}
- Name: GATSBY_TEST_SEARCH_UI
Value: ${self:custom.featureFlagSearchUI}
- Name: GATSBY_SHOW_CHATBOT
Value: ${self:custom.gatsbyUseChatbot}
- Name: FASTLY_MAIN_TOKEN
Value: ${self:custom.fastlyMainToken}
- Name: FASTLY_MAIN_SERVICE_ID
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 @@ -117,6 +117,7 @@ custom:
featureFlagUpdatePages: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/update_pages}
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}
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 @@ -369,6 +369,7 @@ export abstract class JobHandler {
GATSBY_BASE_URL: this._config.get<string>('gatsbyBaseUrl'),
PREVIEW_BUILD_ENABLED: this._config.get<string>('previewBuildEnabled'),
GATSBY_TEST_SEARCH_UI: this._config.get<string>('featureFlagSearchUI'),
GATSBY_SHOW_CHATBOT: this._config.get<string>('gatsbyUseChatbot'),
seungpark marked this conversation as resolved.
Show resolved Hide resolved
};

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 @@ -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\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\n`;
}

static getPathPrefixCases(): Array<any> {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/job/productionJobHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\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\n`,
{ encoding: 'utf8', flag: 'w' }
);
});
Expand Down
1 change: 1 addition & 0 deletions tests/utils/jobHandlerTestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class JobHandlerTestHelper {
this.config.get.calledWith('gatsbyBaseUrl').mockReturnValue('test');
this.config.get.calledWith('previewBuildEnabled').mockReturnValue('false');
this.config.get.calledWith('featureFlagSearchUI').mockReturnValue('false');
this.config.get.calledWith('gatsbyUseChatbot').mockReturnValue('false');
this.repoConnector.checkCommits
.calledWith(this.job)
.mockReturnValue(TestDataProvider.getCommitCheckValidResponse(this.job));
Expand Down
Loading