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

VACMS-18544: next build feature flags #676

Merged
merged 17 commits into from
Sep 27, 2024

Conversation

timcosgrove
Copy link
Contributor

@timcosgrove timcosgrove commented Aug 14, 2024

Description

Do not merge until department-of-veterans-affairs/va.gov-cms#18937 has been merged the work from that PR has filtered down to the main lower Tugboat instance.

This PR, in conjunction with this PR in the CMS, sets up Next Build to use CMS feature flags to determine whether a given content type should be built in Next Build.

Please see https://github.com/department-of-veterans-affairs/next-build/pull/676/files?short_path=a217030#diff-a21703051db1f4ae84b593407423d494143eab7fe3f1f5db420ae1fb3935dad7 for how the feature flags are managed and used in Next Build.

Ticket

department-of-veterans-affairs/va.gov-cms#18544

Developer Task

Tasks

Preview Give feedback

Testing Steps

This is most easily tested with locally-running Next Build against a locally running CMS instance.

Setup

  1. In your local CMS instance, check out main, pull the latest DB (ddev pull va --skip-files), and then ensure it is running correctly.
  2. Check this branch out for Next Build.
  3. Make sure that your .env.local file is pointed towards your local CMS in .env.local. Make sure this is http://va-gov-cms.ddev.site rather than https
  4. Start Next Build locally: yarn dev

First tests - enabling content types from the CMS.

  1. Visit an events listing page: http://localhost:3999/pittsburgh-health-care/events/. This should return a 404/page not found.
  2. Visit the system feature toggle page, https://va-gov-cms.ddev.site/admin/config/system/feature_toggle. Find the Event Listing flag, check it, and save (FEATURE_NEXT_BUILD_CONTENT_EVENT_LISTING).
  3. Stop and restart local Next Build.
  4. Reload http://localhost:3999/pittsburgh-health-care/events/ (it may reload on its own). This should now load.
  5. Visit any event page, i.e. http://localhost:3999/pittsburgh-health-care/events/72337/. It should return a 404.
  6. Visit the system feature toggle page, https://va-gov-cms.ddev.site/admin/config/system/feature_toggle. Find the Event flag, check it, and save (FEATURE_NEXT_BUILD_CONTENT_EVENT).
  7. Stop and restart local Next Build.
  8. Reload http://localhost:3999/pittsburgh-health-care/events/72337/ (it may reload on its own). This page should now load.

Enabling content types from the environment file.

  1. Start your local Next Build if it is not running.
  2. Visit a Vet Center page: http://localhost:3999/oklahoma-city-vet-center/. It should return a 404.
  3. In your envs/.env.local file, add the following variable: FEATURE_NEXT_BUILD_CONTENT_VET_CENTER=true
  4. Stop and restart local Next Build.
  5. Reload http://localhost:3999/oklahoma-city-vet-center/ (it may reload on its own). The page should now load.

Testing the special all content variable.

  1. Start your local Next Build if it is not running.
  2. Visit a Story page: http://localhost:3999/portland-health-care/stories/portland-veteran-receives-first-place-award-for-poetry-entry/. It should return a 404.
  3. In your envs/.env.local file, add the following variable: FEATURE_NEXT_BUILD_CONTENT_ALL=true
  4. Stop and restart local Next Build.
  5. Reload http://localhost:3999/portland-health-care/stories/portland-veteran-receives-first-place-award-for-poetry-entry/ (it may reload on its own). The page should now load.

Reviewer

Reviewing a PR

This section lists items that need to be checked or updated when making changes to this repository.

Standard Checks

Tasks

Preview Give feedback

@timcosgrove timcosgrove marked this pull request as ready for review August 29, 2024 18:38
@va-cms-bot va-cms-bot temporarily deployed to Tugboat August 29, 2024 18:38 Destroyed
@@ -33,8 +33,8 @@ export const processEnv = async (command: string): Promise<void> => {
process.env = {
...process.env,
...{
...envVars,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ordering is switched to allow developer override of feature flags via their env vars, either locally or on a given environment. In the previous setup, the only way to override the feature flags was via cli options, and that will be difficult for devs to work with and nearly impossible to utilize on say a dev or staging environment.

@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 16, 2024 18:05 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 17, 2024 20:51 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 17, 2024 21:45 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 17, 2024 21:59 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 20, 2024 19:23 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 20, 2024 19:25 Destroyed
@va-cms-bot va-cms-bot temporarily deployed to Tugboat September 20, 2024 19:27 Destroyed
@timcosgrove timcosgrove changed the title DNM: VACMS-18544: next build feature flags VACMS-18544: next build feature flags Sep 20, 2024
Copy link
Contributor

@nfpappas-oddball nfpappas-oddball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not already done, please also link the feature flags docs inside of cms readme's so that no information is lost.

@nfpappas-oddball
Copy link
Contributor

Everything seems to work great. Even when i check all options or even add some of the documented but not present options such as FEATURE_NEXT_BUILD_CONTENT_ALL. Everything worked as expected.

@ttran-Therisa
Copy link
Contributor

The testing works for me. I also think the testing instructions would be a great to add to the readme as an example to serve as practice for the user

Copy link
Contributor

@ttran-Therisa ttran-Therisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@timcosgrove timcosgrove merged commit 7031b88 into main Sep 27, 2024
10 checks passed
@timcosgrove timcosgrove deleted the VACMS-18544_next_build_feature_flags branch September 27, 2024 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants