The Site Launch form returns an email per site. Ie when using the form to launch 5 sites, the cms backend will return 5 different emails. This can be a hassle for Ops as they have to keep sieving through each of the email to get the site details.
This PR modifies the site launch logic such that the DNS details of the site launches are consolidated into at most 2 emails (one for successful launches and one for unsuccessful launches)
Other sub-issues closed:
The current code in redirection domain lambda is wrong since
1) The env var was not imported properly
2) The call octokit.request() doesn't return an 404 when a file is not found. Instead, it throws an error, which caused our redirection lambda to crash.
Solution
Rather than sending an email directly to Ops per site launch, now only two emails are sent back to ops. (one for success, and another for failure)
Breaking Changes
[ ] Yes - this PR contains breaking changes
Details ...
[X] No - this PR is backwards compatible
Tests
To just test the functionality of redirection domain lambda:
1) Go to the lambda here. (Note: I have already deployed this version using the npm run deploy:dev -- --stage kishore-test command)
2) Click on the event name testEvent.
3) Run test, notice the lack of any failures.
You can change the test object to:
{ "primaryDomainSource": "<some-other-url>.isomer.gov.sg", "redirectionDomain": [ { "source": "www.<some-other-url>.isomer.gov.sg", "target": "18.136.36.203", "type": "A" } ] }, as long as the .conf file never existed in our branch, it should be updated here. This branch is being used for testing anyways, feel free to test with whatever values you like.
Here is a short video I made to show a trivial testing of the current state of site the site launch form:
To replicate the example shown in the video, one would need to
Change the SITE_LAUNCH_FORM_KEY in your .env to the one in 1password for Form Secret Key Dev Site Launch
In the env OUTGOING_QUEUE_URL, replace outgoingQueue to outgoingQueueKishoreTest
Change NODE_ENV="LOCAL_DEV" (will be tackled in a separate pr)
Populate your local DB for sites, repos and deployments
Run ngrok http 8081
Log into formSG and modify the webhook URL to the one corresponding to ngrok's url.
Populate form with relevant values, then click on submit, see the email output in your local computer
CLEAN UP by removing domain associations in amplify, remove any new rows created in the launches and redirections table.
Deploy Notes
This PR will have conflicts with the recent changes in node var, and the changes with convict PR. These will be addressed in a separate PR, when the changes in identity gets merged into develop. Issues have been raised here and here.
New Env Vars
SITE_LAUNCH_FORM_KEY -> use updated value in 1pw
Review Notes
I feel weird about the naming convention for this function, open to suggestions for this!
Problem
The Site Launch form returns an email per site. Ie when using the form to launch 5 sites, the cms backend will return 5 different emails. This can be a hassle for Ops as they have to keep sieving through each of the email to get the site details. This PR modifies the site launch logic such that the DNS details of the site launches are consolidated into at most 2 emails (one for successful launches and one for unsuccessful launches)
Other sub-issues closed: The current code in redirection domain lambda is wrong since 1) The env var was not imported properly 2) The call
octokit.request()
doesn't return an 404 when a file is not found. Instead, it throws an error, which caused our redirection lambda to crash.Solution
Rather than sending an email directly to Ops per site launch, now only two emails are sent back to ops. (one for success, and another for failure)
Breaking Changes
Tests
To just test the functionality of redirection domain lambda:
1) Go to the lambda here. (Note: I have already deployed this version using the
npm run deploy:dev -- --stage kishore-test
command) 2) Click on the event nametestEvent
. 3) Run test, notice the lack of any failures.You can change the test object to:
{ "primaryDomainSource": "<some-other-url>.isomer.gov.sg", "redirectionDomain": [ { "source": "www.<some-other-url>.isomer.gov.sg", "target": "18.136.36.203", "type": "A" } ] }
, as long as the .conf file never existed in our branch, it should be updated here. This branch is being used for testing anyways, feel free to test with whatever values you like.Here is a short video I made to show a trivial testing of the current state of site the site launch form:
https://user-images.githubusercontent.com/42832651/227849536-db8b5f89-bbec-4ac5-9956-6168a074e299.mp4
To replicate the example shown in the video, one would need to
Form Secret Key Dev Site Launch
outgoingQueue
tooutgoingQueueKishoreTest
sites
,repos
anddeployments
ngrok http 8081
launches
andredirections
table.Deploy Notes
This PR will have conflicts with the recent changes in node var, and the changes with convict PR. These will be addressed in a separate PR, when the changes in identity gets merged into develop. Issues have been raised here and here.
New Env Vars
SITE_LAUNCH_FORM_KEY -> use updated value in 1pw
Review Notes
I feel weird about the naming convention for this function, open to suggestions for this!