Skip to content

Commit 7246b5f

Browse files
authored
Merge pull request #2435 from ustaxcourt/staging
Merge staging into prod
2 parents 67a3553 + bf8402d commit 7246b5f

File tree

18 files changed

+690
-568
lines changed

18 files changed

+690
-568
lines changed

cypress-smoketests/support/pages/trial-sessions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ exports.createTrialSession = (testData, overrides = {}) => {
5555

5656
cy.get('#chambers-phone-number').type(faker.phone.number());
5757
cy.get('#trial-clerk').select(testData.trialClerk || 'Test trialclerk1');
58-
cy.get('#court-reporter').type(faker.name.findName());
59-
cy.get('#irs-calendar-administrator').type(faker.name.findName());
58+
cy.get('#court-reporter').type(faker.name.fullName());
59+
cy.get('#irs-calendar-administrator').type(faker.name.fullName());
6060
cy.get('#notes').type(faker.company.catchPhrase());
6161

6262
cy.get('#submit-trial-session').click();

docs/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ If you're ready for the challenge, navigate to the [Getting Started Guide](/gett
2626

2727
Otherwise, if you're just interested in a particular topic, you can find it in the sidebar.
2828

29+
## Onboarding Resources
30+
31+
The onboarding checklist and quick reference guide will be handy as you navigate your first couple months. Please reach out to your onboarding buddy with questions. If you don't have a buddy and want one, please ask the team about it!
32+
33+
1. [Onboarding Checklist](https://docs.google.com/document/d/12twlx5nLG6B4R6ds96wh_gZ6wR5Y_PGjsmSeP98V6o0): Make a copy as this will be your personal checklist of important tasks as you onboard
34+
2. [Onboarding Quick Reference Guide](https://docs.google.com/document/d/1ObraR8X5YUzR1GIwsm903EhS7-AQbpy90--5aAWysKU): A hodge-podge of helpful links, information, who's who, what's what
35+
2936
## Looking for Old Docs?
3037

3138
Most of the older documentation was moved directly into this docsify directory. The goal is to eventually incorporate them into the top level sections of this documentation, or move them to a common sub directory if they don't fit well into the incremental introduction approach the documentation is attempting to follow. They can be found on one of the following links:

docs/additional-resources/blue-green-migration.md

+82-8
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,30 @@
44

55
Every deployment, whether it's to production or a development environment, is a blue-green deployment. We build a copy for the resources that are required to run a second version of the application. When the copy is ready and tested, we switch the client over to run off of the newly deployed color and have the old color available for rolling back.
66

7-
Additionally, for deployments that require change in the data schema or broad stroke changes to the database in order for the application to function, we build an empty copy of the data stores (DynamoDB and Elasticsearch). Then we perform a migration of information from the old data store into the newly created one. This migration passes all of the data through a lambda to update and verify the data before saving it into a new data store.
7+
Additionally, for deployments that require change in the data schema or elasticsearch mappings in order for the application to function, we build an empty copy of the data stores (DynamoDB and Elasticsearch). Then we perform a migration of information from currently running DynamoDB database table (*source table*) into the newly created, empty one (*destination table*). This migration passes all of the data through a lambda to update and verify the data before saving it into the destination table.
88

99
## Automated Migration Steps
1010

1111
**All of the automated migration steps are now handled by CircleCI, as defined in `config.yml`.**
1212

1313
Some key steps, excluding automated tests, include:
1414

15+
### Manual Steps required before attempting an automated Migration
16+
17+
If the destination table exists in either `us-east-1` or `us-west=1`, you will have to delete it before kicking off a CircleCI deployment.
18+
1519
### Deploy, Migrate, and Reindex
20+
1621
- Deploy updated infrastructure.
1722
- `migrate` is automatically determined if there are expected migration scripts that do not exist in the DynamoDB table.
18-
- Disable destination table stream.
19-
- Migration runs.
20-
- SQS queue empties.
21-
- Enable destination table stream.
23+
- Disable destination table stream.
24+
- Migration runs.
25+
- SQS queue empties.
26+
- Enable destination table stream.
2227
- ElasticSearch reindexes, and a cron runs to determine if the reindex completes. This will approve the next step in the workflow to run.
2328

2429
### Post-successful Deploy
30+
2531
- Switch the current color and deployed color.
2632
- If deploying the `prod` environment, backup the source's DynamoDB table.
2733
- Delete the source's API gateway mappings, both non-public and public.
@@ -30,12 +36,80 @@ Some key steps, excluding automated tests, include:
3036
- Delete the source's DynamoDB table in `east` and `west` regions.
3137
- Toggle the deploy table's values for `migrate` and `source-table-version`.
3238

33-
3439
## Manual Migration Steps
3540

3641
The application kicks off a migration automatically if it detects migrations that need to be run in the codebase that haven't yet been run upon that environment. In order to force a migration, perform the following manual steps. You might do this if you were doing a package update that might impact the migration and wanted to test it fully.
3742

38-
1. Remove a migration script item from the environment's `efcms-<ENV>-deploy` DynamoDB table that is expected to migrate, from the `migrationsToRun.js` file. For example, if `migrationsToRun.js` includes a script called `0001-test-script.js`, delete that item from the DynamoDB table.
39-
2. Kick off a CircleCI workflow, which will follow the steps above for Automated Migration Steps.
43+
There are two good ways to trigger a manual migration. You can either [remove the record from the deploy table](#remove-record-of-previous-migration) of one of the previously run migrations, or you can [explicitly configure the deploy table to run a migration](#explicitly-configure-deploy-table) on next deploy.
44+
45+
The first step of either is to [delete the destination table](#delete-the-destination-tables)
46+
47+
### Delete the Destination Tables
48+
49+
We need to delete the destination tables (if they exist) in order to perform a blue green migration. It is preferred to delete the `west` table first mainly because we are using a DynamoDB Global table and replication.
50+
51+
The `east` table is master table, and if you delete these tables and recreate them. You will be unable to delete the `east` table until you delete the `west` table. AWS will throw an error if you attempt to delete the `east` table before the `west` table if both exist and they have been deleted within the last 24 hours.
52+
53+
#### Via the command line
54+
55+
1. Identify the **destination table**. For example, if we're performing a deployment to `dev`:
56+
57+
```bash
58+
$ ./scripts/dynamo/get-source-table.sh dev
59+
efcms-dev-beta
60+
$ ./scripts/dynamo/get-destination-table.sh dev
61+
efcms-dev-beta
62+
```
63+
64+
Both should be the same value, and that is what the application is currently using as it its main data store. If they are both `alpha`, then the destination table is `beta`. If they are both `beta`, the destination table is `alpha`.
65+
66+
If they are different, inspect the Lamdba's environment config to determine what table the application is currently using. If that is `beta`, then the destination table is `alpha`, and vice versa.
67+
68+
2. Check to see if the **destination table** exists. You can do this via the AWS Console or AWS CLI:
69+
70+
```bash
71+
$ aws dynamodb describe-table --table-name efcms-dev-alpha
72+
```
73+
74+
If you get an error, `An error occurred (ResourceNotFoundException) when calling the DescribeTable operation: Requested resource not found: Table: efcms-dev-alpha not found`, then you are ready to proceed with the deployment.
75+
76+
If you do not, then it exists, and you must delete the table.
77+
78+
3. If it exists, delete the **destination table** in both `east` and `west`. You can do this via the AWS Console or AWS CLI:
79+
80+
```bash
81+
$ aws dynamodb delete-table --table-name efcms-dev-alpha --region us-west-1
82+
$ aws dynamodb delete-table --table-name efcms-dev-alpha --region us-east-1
83+
```
84+
85+
NOTE: after deleting the `west` table, you may have to wait a few minutes before you can delete the `east` table.
86+
87+
88+
#### Via the console
89+
90+
1. Identify the source table and destination table. Both should be the same value, and that is what the application is currently using as it its main data store. If they are both `alpha`, then the destination table is `beta`. If they are both `beta`, the destination table is `alpha`. If they are different, inspect at the current color Lamdba's environment config to determine the dynamo table that the application is currently using as its data store.
91+
2. Change the value for the `current` key of the `pk`:`destination-table-version` to the destination table you identified in step 3 (`alpha` or `beta`).
92+
3. Switch to the `west-1` region.
93+
4. Delete the destination table in `west`
94+
5. Go back to east region
95+
6. Delete the destination table in `east`; note this may take a few minutes as the west table is deleting.
96+
97+
### Remove Record of Previous Migration
98+
99+
1. Delete the Destination table [see instructions](#delete-the-destination-tables)
100+
2. Remove a migration script item from the environment's `efcms-<ENV>-deploy` DynamoDB table that is expected to migrate, from the `migrationsToRun.js` file. For example, if `migrationsToRun.js` includes a script called `0001-test-script.js`, delete that item from the DynamoDB table.
101+
3. Kick off a CircleCI workflow, which will follow the steps above for Automated Migration Steps.
102+
103+
### Explicitly Configure Deploy Table
104+
105+
1. Go into the environment's deploy table `efcms-<ENV>-deploy`
106+
2. Change the `migrate` flag to `true`
107+
3. Identify the source table and destination table. Both should be the same value, and that is what the application is currently using as it its main data store. If they are both `alpha`, then the destination table is `beta`. If they are both `beta`, the destination table is `alpha`. If they are different, inspect at the current color Lamdba's environment config to determine the dynamo table that the application is currently using as its data store.
108+
4. Change the value for the `current` key of the `pk`:`destination-table-version` to the destination table you identified in step 3 (`alpha` or `beta`).
109+
5. Switch to the `west-1` region.
110+
6. Delete the destination table in `west`
111+
7. Go back to east region
112+
8. Delete the destination table in `east`; note this may take a few minutes as the west table is deleting.
113+
9. Kick off a CircleCI workflow, which will follow the steps above for Automated Migration Steps.
40114
41115
See [the troubleshooting guide](TROUBLESHOOTING.md) for solutions to problems that may arise during the migration process.

docs/team-process.md

+11-15
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
Now that you've logged in and played around with our Dawson system a bit on a deployed environment, let's talk about our team process and what is expected from our fellow teammates. This part of the documentation should help members get on the same page when it comes to the soft-skills required to work as a well-oiled agile machine.
44

5-
## Onboarding
6-
7-
Here are some few resources for documentation associated with onboarding:
8-
9-
1. [Onboarding checklist](https://docs.google.com/document/d/1zhvp8vcWnVSvUbTKZ-0sHrf5lA6OTlpXqvjeLgKJtVk)
10-
2. [Onboarding Reference Guide](https://docs.google.com/document/d/1jOd0wAsqTDBKsFeEvUj9ezvdTimTsqTwkYd6Imibl3c)
11-
12-
If you do not have permissions to view these documents, please reach out to the document owner.
13-
145
## Working Agreement
156

167
We have talked about writing some form of working agreement so team members have a common understanding of what is expected from them during their daily work. Great teams strive for open communication, safe spaces to speak their mind, and continuous improvement in process. Embracing some of the following ideologies will help grow and sustain a healthy team.
@@ -158,9 +149,14 @@ If dependencies have no patch, replace it with an alternative, or wait for the l
158149

159150
Below is a list of dependencies that are locked down due to known issues with security, integration problems within DAWSON, etc. Try to update these items but please be aware of the issue that's documented and ensure it's been resolved.
160151

161-
- `@fortawesome` packages locked down to versions pre-6.x.x to maintain consistency of icon styling until there is usability feedback and research that determines we should change them. This includes packages:
162-
- `@fortawesome/free-solid-svg-icons`
163-
- `@fortawesome/free-regular-svg-icons`
164-
- `@fortawesome/fontawesome-svg-core`
165-
166-
- It'd be good to keep an eye on `s3rver` for when it exceeds 3.7.1. We have a patch in place for called `s3rver+3.7.1.patch` in order to address the high severity issue exposed by `s3rver`'s dependency on `busboy` 0.3.1, which relies on `dicer` that actually has the [security issue](https://github.com/advisories/GHSA-wm7h-9275-46v2). Unfortunately, `busboy` >0.3.1, aka ^1.0.0, is incompatible with s3rver which is why there's a patch in place to make it compatible.
152+
1. `@fortawesome` packages locked down to versions pre-6.x.x to maintain consistency of icon styling until there is usability feedback and research that determines we should change them. This includes packages:
153+
- `@fortawesome/free-solid-svg-icons`
154+
- `@fortawesome/free-regular-svg-icons`
155+
- `@fortawesome/fontawesome-svg-core`
156+
157+
2. Check if there are updates to `s3rver` above version [3.7.1](https://www.npmjs.com/package/s3rver).
158+
- Why is there a patch called `s3rver+3.7.1.patch`?
159+
- To address the high severity issue exposed by `s3rver`'s dependency on `busboy` 0.3.1, which relies on `dicer` that actually has the [security issue](https://github.com/advisories/GHSA-wm7h-9275-46v2). Unfortunately, `busboy` >0.3.1, aka ^1.0.0, is incompatible with s3rver which is why there's a patch in place to make it compatible.
160+
- How does the patch run?
161+
- This runs as part of the `npm postinstall` step.
162+
- Common troubleshooting: If you see the high severity audit issue warning for `dicer`, run a full `npm install` rather than a single package update, as this will run the `postinstall` which is required to run the patch that addresses the security issue.

docs/testing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ This will run the linter, Shellcheck, audit, build, test, Cypress, Cerebral test
311311

312312
## PDF Testing
313313

314-
Since our system generates a lot of PDFs, we have a set of tests that verify the pdfs didn't change using a checksum of the first exported image of the pdfs. Since all of these PDFs share a single .scss file, there is risk involved when trying to update a single PDF to accidentally change the styles of other PDFs. Therefore, we have a set of tests that verify that the PDFs are not changing.
314+
Since our system generates a lot of PDFs, we have a set of tests that verify the PDFs didn't change using a checksum of the first exported image of the PDFs. Since all of these PDFs share a single .scss file, there is risk involved when trying to update a single PDF to accidentally change the styles of other PDFs. Therefore, we have a set of tests that verify that the PDFs are not changing.
315315

316-
If you are adding/creating a new PDF you must add the PDF name to the pdfs array in image-compare-pdfs.js.
316+
If you are adding/creating a new PDF you must add the PDF name to the `pdfs` array in image-compare-pdfs.js.
317317

318318
All of the expected output images are found in the `./shared/test-pdf-expected-images` directory. In order to update these, you will need to run the following command:
319319

iam/terraform/environment-specific/main/update-petitioner-cases-lambda-role.tf

+8-9
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ resource "aws_iam_role_policy" "iam_update_petitioner_cases_lambda_policy" {
5757
],
5858
"Effect": "Allow"
5959
},
60-
{
61-
"Action": [
62-
"ses:SendBulkTemplatedEmail"
63-
],
64-
"Resource": [
65-
"arn:aws:ses:us-east-1:${data.aws_caller_identity.current.account_id}:identity/noreply@${var.dns_domain}"
66-
],
67-
"Effect": "Allow"
68-
},
6960
{
7061
"Action": [
7162
"s3:DeleteObject",
@@ -94,6 +85,14 @@ resource "aws_iam_role_policy" "iam_update_petitioner_cases_lambda_policy" {
9485
],
9586
"Resource": "arn:aws:sqs:us-east-1:${data.aws_caller_identity.current.account_id}:update_petitioner_cases_queue_${var.environment}_*",
9687
"Effect": "Allow"
88+
},
89+
{
90+
"Action": [
91+
"sqs:SendMessage",
92+
"sqs:DeleteMessage"
93+
],
94+
"Resource": "arn:aws:sqs:us-east-1:${data.aws_caller_identity.current.account_id}:send_emails_queue_${var.environment}_*",
95+
"Effect": "Allow"
9796
}
9897
]
9998
}

lint-pa11y.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { execSync } = require('child_process');
2+
3+
/** Map of forbidden words and their match regex */
4+
const words = {
5+
only: '\\s*only\\:',
6+
};
7+
8+
let status = 0;
9+
for (let word of Object.keys(words)) {
10+
const matchRegex = words[word];
11+
const gitCommand = `git diff --staged -G"${matchRegex}" --name-only`;
12+
const badFiles = execSync(gitCommand).toString();
13+
const filesAsArray = badFiles.split('\n');
14+
const jsFileRegex = /\.js$/;
15+
const onlyJsFiles = filesAsArray.filter(file =>
16+
jsFileRegex.test(file.trim()),
17+
);
18+
if (onlyJsFiles.length) {
19+
status = 1;
20+
console.log(
21+
`The following files contain a focused pa11y test with '${word}' in them:`,
22+
);
23+
console.log(onlyJsFiles.join('\n'));
24+
}
25+
}
26+
process.exit(status);

0 commit comments

Comments
 (0)