Skip to content

Commit

Permalink
Merge pull request #287 from flexion/sprint-43.5
Browse files Browse the repository at this point in the history
Sprint 43.5
  • Loading branch information
JessicaMarine authored Jul 17, 2020
2 parents 4c27599 + 273b075 commit e52fbb1
Show file tree
Hide file tree
Showing 810 changed files with 11,884 additions and 8,002 deletions.
193 changes: 117 additions & 76 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: 2.1
jobs:
bundle:
resource_class: large
build-api:
docker:
- image: $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/ef-cms-us-east-1:latest
aws_auth:
Expand All @@ -22,25 +21,10 @@ jobs:
- '.git'
- run:
name: NPM - Install
command: npm ci && npm rebuild node-sass
- persist_to_workspace:
root: ~/
paths:
- project

build-api:
docker:
- image: $AWS_ACCOUNT_ID.dkr.ecr.us-east-1.amazonaws.com/ef-cms-us-east-1:latest
aws_auth:
aws_access_key_id: $AWS_ACCESS_KEY_ID
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY
steps:
- attach_workspace:
at: ~/
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Lint
command: |
npm run lint
command: npm run lint
- run:
name: Shellcheck
command: |
Expand Down Expand Up @@ -72,8 +56,21 @@ jobs:
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY
resource_class: xlarge
steps:
- attach_workspace:
at: ~/
- restore_cache:
name: Source - Restoring Cache
keys:
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- source-{{ .Environment.CACHE_VERSION }}-
- checkout
- save_cache:
name: Source - Saving Cache
key: deps-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
paths:
- '.git'
- run:
name: NPM - Install
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Shared - Test
command: npm run test:shared
Expand Down Expand Up @@ -101,8 +98,21 @@ jobs:
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY
resource_class: xlarge
steps:
- attach_workspace:
at: ~/
- restore_cache:
name: Source - Restoring Cache
keys:
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- source-{{ .Environment.CACHE_VERSION }}-
- checkout
- save_cache:
name: Source - Saving Cache
key: deps-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
paths:
- '.git'
- run:
name: NPM - Install
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Web Client - Unit Test
command: npm run build:assets && CI=false npm run test:client:unit
Expand All @@ -125,23 +135,37 @@ jobs:
resource_class: xlarge
parallelism: 5
steps:
- attach_workspace:
at: ~/
- restore_cache:
name: Source - Restoring Cache
keys:
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- source-{{ .Environment.CACHE_VERSION }}-
- checkout
- save_cache:
name: Source - Saving Cache
key: deps-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
paths:
- '.git'
- run:
name: NPM - Install
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Create web-client Artifacts Directory
command: mkdir /tmp/web-client/
- run:
name: Web Client - Integration Test
command: |
SKIP_CACHE_INVALIDATION=true AWS_ACCESS_KEY_ID=noop AWS_SECRET_ACCESS_KEY=noop npm run start:api:ci > /tmp/web-client/server-output.txt &
TEMP_DOCUMENTS_BUCKET_NAME=noop-temp-documents-local-us-east-1 DOCUMENTS_BUCKET_NAME=noop-documents-local-us-east-1 S3_ENDPOINT=http://localhost:9000 SKIP_CACHE_INVALIDATION=true AWS_ACCESS_KEY_ID=noop AWS_SECRET_ACCESS_KEY=noop npm run start:api:ci > /tmp/web-client/server-output.txt &
./wait-until.sh http://localhost:4000/api/swagger
TESTFILES=$(circleci tests glob "web-client/integration-tests/*.test.js" "web-client/integration-tests-public/*.test.js" | circleci tests split --split-by=timings)
CI=true NO_SCANNER=true SKIP_VIRUS_SCAN=true AWS_ACCESS_KEY_ID=noop AWS_SECRET_ACCESS_KEY=noop npx jest --coverageDirectory=./coverage-integration-${CIRCLE_NODE_INDEX} --runInBand --config web-client/jest-integration.config.js ${TESTFILES}
CI=true NO_SCANNER=true SKIP_VIRUS_SCAN=true AWS_ACCESS_KEY_ID=noop AWS_SECRET_ACCESS_KEY=noop TEMP_DOCUMENTS_BUCKET_NAME=noop-temp-documents-local-us-east-1 DOCUMENTS_BUCKET_NAME=noop-documents-local-us-east-1 S3_ENDPOINT=http://localhost:9000 npx jest --coverageDirectory=./coverage-integration-${CIRCLE_NODE_INDEX} --runInBand --config web-client/jest-integration.config.js ${TESTFILES}
- store_artifacts:
path: /tmp/web-client
- persist_to_workspace:
root: ~/
paths:
- project/web-client
- project/web-client/coverage-integration-*

build-client-coverage:
Expand Down Expand Up @@ -196,8 +220,21 @@ jobs:
_JAVA_OPTIONS: '-Xms2048m -Xmx4096m'
resource_class: xlarge
steps:
- attach_workspace:
at: ~/
- restore_cache:
name: Source - Restoring Cache
keys:
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- source-{{ .Environment.CACHE_VERSION }}-
- checkout
- save_cache:
name: Source - Saving Cache
key: deps-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
paths:
- '.git'
- run:
name: NPM - Install
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Create Pa11y Artifacts Directory
command: mkdir /tmp/pa11y
Expand Down Expand Up @@ -231,8 +268,21 @@ jobs:
_JAVA_OPTIONS: '-Xms1024m -Xmx2048m'
resource_class: xlarge
steps:
- attach_workspace:
at: ~/
- restore_cache:
name: Source - Restoring Cache
keys:
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- source-{{ .Environment.CACHE_VERSION }}-
- checkout
- save_cache:
name: Source - Saving Cache
key: deps-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
paths:
- '.git'
- run:
name: NPM - Install
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Create Cypress Artifacts Directory
command: mkdir /tmp/cypress
Expand Down Expand Up @@ -270,8 +320,21 @@ jobs:
_JAVA_OPTIONS: '-Xms1024m -Xmx2048m'
resource_class: xlarge
steps:
- attach_workspace:
at: ~/
- restore_cache:
name: Source - Restoring Cache
keys:
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- source-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- source-{{ .Environment.CACHE_VERSION }}-
- checkout
- save_cache:
name: Source - Saving Cache
key: deps-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
paths:
- '.git'
- run:
name: NPM - Install
command: npm set progress=false && npm ci && npm rebuild node-sass
- run:
name: Create Cypress Artifacts Directory
command: mkdir /tmp/cypress
Expand Down Expand Up @@ -332,10 +395,10 @@ jobs:
# command: docker run -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" --rm efcms /bin/sh -c "cd web-api && ./switch-environment-color.sh ${ENV}"
- run:
name: 'Deploy - Web Client - S3'
command: docker run -e "DYNAMSOFT_URL_OVERRIDE=${DYNAMSOFT_URL_OVERRIDE}" -e "ENV=${ENV}" -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" -e "COGNITO_SUFFIX=${COGNITO_SUFFIX}" -e "CIRCLE_SHA1=${CIRCLE_SHA1}" -e "CIRCLE_HONEYBADGER_API_KEY=${CIRCLE_HONEYBADGER_API_KEY}" --rm efcms /bin/sh -c "./web-client/build-dist.sh $ENV && aws s3 sync dist s3://ui-${ENV}.${EFCMS_DOMAIN} --delete && aws s3 cp s3://ui-${ENV}.${EFCMS_DOMAIN}/index.html s3://ui-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --cache-control max-age=0 && aws s3 sync dist s3://failover-ui-${ENV}.${EFCMS_DOMAIN} --delete --cache-control no-cache && aws s3 cp s3://failover-ui-${ENV}.${EFCMS_DOMAIN}/index.html s3://failover-ui-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --cache-control max-age=0"
command: docker run -e "DYNAMSOFT_URL_OVERRIDE=${DYNAMSOFT_URL_OVERRIDE}" -e "ENV=${ENV}" -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" -e "COGNITO_SUFFIX=${COGNITO_SUFFIX}" -e "CIRCLE_SHA1=${CIRCLE_SHA1}" -e "CIRCLE_HONEYBADGER_API_KEY=${CIRCLE_HONEYBADGER_API_KEY}" --rm efcms /bin/sh -c "./web-client/build-dist.sh $ENV && aws s3 sync dist s3://ui-${ENV}.${EFCMS_DOMAIN} --delete && aws s3 cp s3://ui-${ENV}.${EFCMS_DOMAIN}/index.html s3://ui-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --content-type text/html --cache-control max-age=0 && aws s3 sync dist s3://failover-ui-${ENV}.${EFCMS_DOMAIN} --delete --cache-control no-cache && aws s3 cp s3://failover-ui-${ENV}.${EFCMS_DOMAIN}/index.html s3://failover-ui-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --content-type text/html --cache-control max-age=0"
- run:
name: 'Deploy - Public Web Client - S3'
command: docker run -e "ENV=${ENV}" -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" -e "COGNITO_SUFFIX=${COGNITO_SUFFIX}" -e "CIRCLE_SHA1=${CIRCLE_SHA1}" --rm efcms /bin/sh -c "./web-client/build-dist-public.sh $ENV && aws s3 sync dist-public s3://ui-public-${ENV}.${EFCMS_DOMAIN} --delete && aws s3 cp s3://ui-public-${ENV}.${EFCMS_DOMAIN}/index.html s3://ui-public-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --cache-control max-age=0 && aws s3 sync dist-public s3://failover-ui-public-${ENV}.${EFCMS_DOMAIN} --delete --cache-control no-cache && aws s3 cp s3://failover-ui-public-${ENV}.${EFCMS_DOMAIN}/index.html s3://failover-ui-public-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --cache-control max-age=0"
command: docker run -e "ENV=${ENV}" -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" -e "COGNITO_SUFFIX=${COGNITO_SUFFIX}" -e "CIRCLE_SHA1=${CIRCLE_SHA1}" --rm efcms /bin/sh -c "./web-client/build-dist-public.sh $ENV && aws s3 sync dist-public s3://ui-public-${ENV}.${EFCMS_DOMAIN} --delete && aws s3 cp s3://ui-public-${ENV}.${EFCMS_DOMAIN}/index.html s3://ui-public-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --content-type text/html --cache-control max-age=0 && aws s3 sync dist-public s3://failover-ui-public-${ENV}.${EFCMS_DOMAIN} --delete --cache-control no-cache && aws s3 cp s3://failover-ui-public-${ENV}.${EFCMS_DOMAIN}/index.html s3://failover-ui-public-${ENV}.${EFCMS_DOMAIN}/index.html --metadata-directive REPLACE --content-type text/html --cache-control max-age=0"
- run:
name: 'Deploy - Web API - Global Tables'
command: docker run -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" --rm efcms /bin/sh -c "cd web-api && node setup-global-tables.js efcms-${ENV} us-east-1,us-west-1"
Expand Down Expand Up @@ -401,35 +464,32 @@ jobs:
else
echo "skipping…"
fi
- run:
name: 'Deploy - Authorizer Smoke Tests'
command: |
docker run -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" --rm efcms /bin/sh -c "npm run verify-authorizers -- ${ENV}"
- run:
name: 'Deploy - Verify Private S3 Buckets'
command: |
docker run -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" --rm efcms /bin/sh -c "npm run verify-private-s3-buckets -- ${ENV}"
- run:
name: 'Deploy - Verify Private Elasticsearch'
command: |
docker run -e "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" -e "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" -e "EFCMS_DOMAIN=${EFCMS_DOMAIN}" --rm efcms /bin/sh -c "npm run verify-private-elasticsearch -- ${ENV}"
- store_artifacts:
path: /home/app/cypress-smoketests/videos/

workflows:
version: 2
hourly:
jobs:
- bundle
- build-shared:
requires:
- bundle
- build-api:
requires:
- bundle
- build-client-unit:
requires:
- bundle
- build-client-integration:
requires:
- bundle
- e2e-pa11y:
requires:
- bundle
- e2e-cypress:
requires:
- bundle
- e2e-cypress-public:
requires:
- bundle
- build-shared
- build-api
- build-client-unit
- build-client-integration
- e2e-pa11y
- e2e-cypress
- e2e-cypress-public
- build-client-coverage:
requires:
- build-shared
Expand All @@ -451,56 +511,37 @@ workflows:
- develop
build-and-deploy:
jobs:
- bundle:
filters:
branches:
ignore:
- develop
- build-shared:
requires:
- bundle
filters:
branches:
ignore:
- develop
- build-api:
requires:
- bundle
filters:
branches:
ignore:
- develop
- build-client-unit:
requires:
- bundle
filters:
branches:
ignore:
- develop
- build-client-integration:
requires:
- bundle
filters:
branches:
ignore:
- develop
- e2e-pa11y:
requires:
- bundle
filters:
branches:
ignore:
- develop
- e2e-cypress:
requires:
- bundle
filters:
branches:
ignore:
- develop
- e2e-cypress-public:
requires:
- bundle
filters:
branches:
ignore:
Expand Down
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = {
],
rules: {
'arrow-parens': ['error', 'as-needed'],
complexity: ['warn', { max: 80 }], // todo: plugin default is 20, try to lower this
complexity: ['error', { max: 40 }], // todo: plugin default is 20, try to lower this
'import/named': 'warn',
'import/no-default-export': 'error',
'import/no-named-as-default': 'off',
Expand Down Expand Up @@ -381,7 +381,7 @@ module.exports = {
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx'],
extensions: ['.js', '.jsx', '.json'],
},
},
react: {
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ web-api/runtimes/clamav/bin
web-api/runtimes/clamav/clamav_lambda_layer.tar.gz
web-api/runtimes/clamav/lib
web-api/storage/s3/*
web-api/terraform/main/new-policy.json
web-api/terraform/template/lambdas/api-public.js.zip
web-api/terraform/template/lambdas/api.js.zip
web-api/terraform/template/lambdas/cognito-authorizer.js.zip
Expand All @@ -40,7 +41,6 @@ web-api/terraform/template/lambdas/cron.js.zip
web-api/terraform/template/lambdas/log-forwarder.js.zip
web-api/terraform/template/lambdas/streams.js.zip
web-api/terraform/template/lambdas/websockets.js.zip
web-api/terraform/main/new-policy.json
web-client/.cache/
web-client/coverage-e2e
web-client/coverage-integration/*
Expand Down
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ RUN apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 lib
git bash openssh-client python python-dev python-pip python-setuptools ca-certificates less \
unzip wget jq shellcheck clamav

ENV AWS_CLI_VERSION 1.16.31
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install
RUN rm awscliv2.zip

RUN freshclam

RUN pip install --upgrade pip
RUN apt-get install -y awscli && \
pip install --upgrade awscli==${AWS_CLI_VERSION} && \
wget -q -O terraform_0.11.14_linux_amd64.zip https://releases.hashicorp.com/terraform/0.11.14/terraform_0.11.14_linux_amd64.zip && \
unzip -o terraform_0.11.14_linux_amd64.zip terraform && \
RUN wget -q -O terraform_0.12.28_linux_amd64.zip https://releases.hashicorp.com/terraform/0.12.28/terraform_0.12.28_linux_amd64.zip && \
unzip -o terraform_0.12.28_linux_amd64.zip terraform && \
cp terraform /usr/local/bin/ && \
curl -OL 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip' && \
mkdir sonar_scanner && \
Expand All @@ -44,8 +46,7 @@ ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
COPY package.json /home/app/package.json
COPY package-lock.json /home/app/package-lock.json
RUN npm set progress=false && \
npm config set puppeteer_skip_chromium_download true && \
npm i
npm ci

COPY . /home/app

Expand Down
3 changes: 2 additions & 1 deletion cypress-public.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"defaultCommandTimeout": 20000,
"requestTimeout": 12000,
"viewportWidth": 1200,
"viewportHeight": 900
"viewportHeight": 900,
"testFiles": "public/*.spec.js"
}
Loading

0 comments on commit e52fbb1

Please sign in to comment.