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

build: merge release 4.48.2 into master #843

Merged
merged 35 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
256c582
Merge pull request #719 from opengovsg/release-4.47.0
mantariksh Nov 24, 2020
7fd378f
docs: add script for unlisting array of forms (#714)
mantariksh Nov 24, 2020
8e13a24
chore(deps-dev): bump lint-staged from 10.5.1 to 10.5.2 (#722)
dependabot[bot] Nov 24, 2020
a99fd94
chore(deps-dev): bump stylelint from 13.6.1 to 13.8.0 (#721)
dependabot[bot] Nov 24, 2020
9d25c53
chore(deps-dev): bump prettier from 2.1.2 to 2.2.0 (#709)
dependabot[bot] Nov 24, 2020
cb50ec0
fix(AdminFormRoutes): add Joi validation on /submission endpoint (#712)
karrui Nov 25, 2020
29e1a94
feat: migrate get encrypt metadata endpoint controller to TypeScript …
karrui Nov 25, 2020
2aaf4db
refactor: migrate radio button validator to ts (#723)
tshuli Nov 25, 2020
ea7c6e8
refactor: migrate rating validator to ts (#724)
tshuli Nov 25, 2020
eb93d5d
chore(deps-dev): bump ts-jest from 26.4.1 to 26.4.4 (#720)
dependabot[bot] Nov 25, 2020
9b84a2f
refactor: migrate mobile number validator to ts (#713)
tshuli Nov 25, 2020
0af9198
fix(deps): bump winston-cloudwatch from 2.3.2 to 2.4.0 (#728)
dependabot[bot] Nov 25, 2020
819221e
fix(deps): bump angular-messages from 1.8.1 to 1.8.2 (#725)
dependabot[bot] Nov 25, 2020
ea4d7d5
fix(deps): bump express-rate-limit from 5.1.3 to 5.2.3 (#726)
dependabot[bot] Nov 25, 2020
954055f
feat: remove .oa file from allowed file types (#731)
karrui Nov 26, 2020
4602ebb
feat(utils): add exhaustive switch case typeguard (#729)
karrui Nov 26, 2020
b08a588
refactor(field-validation): simplify (#734)
mantariksh Nov 26, 2020
5b8b382
ref: migrate stream feedback flow to TypeScript (#733)
karrui Nov 26, 2020
db1960a
chore(deps-dev): bump eslint from 7.13.0 to 7.14.0 (#741)
dependabot[bot] Nov 26, 2020
7784c48
chore(deps-dev): bump @babel/preset-env from 7.12.1 to 7.12.7 (#740)
dependabot[bot] Nov 26, 2020
84c7d7c
fix(deps): bump opossum from 5.0.1 to 5.0.2 (#738)
dependabot[bot] Nov 26, 2020
0fb552c
ref: migrate get feedback flow to TypeScript (#735)
karrui Nov 30, 2020
111f1fa
chore: update travis to have multiple ci stages (#742)
karrui Nov 30, 2020
7c8c42f
chore(deps-dev): bump ts-mock-imports from 1.3.0 to 1.3.1 (#747)
dependabot[bot] Nov 30, 2020
5665c82
chore(deps-dev): bump @types/mongoose from 5.10.0 to 5.10.1 (#746)
dependabot[bot] Nov 30, 2020
a55f562
fix(deps): bump celebrate from 13.0.3 to 13.0.4 (#756)
dependabot[bot] Nov 30, 2020
20008ed
fix(deps): bump mongoose from 5.10.15 to 5.10.18 (#758)
dependabot[bot] Nov 30, 2020
0fbfc81
fix: backend validation does not prevent responses on hidden fields (…
tshuli Nov 30, 2020
5084707
chore: add Go and Postman tips on Share tab (#759)
mantariksh Dec 1, 2020
24866f6
chore: bump version to v4.48.0
karrui Dec 1, 2020
3bb2d2b
fix: skip travis artifact cleanup
karrui Dec 1, 2020
fead8ce
Revert "fix: backend validation does not prevent responses on hidden …
karrui Dec 1, 2020
7e6267d
chore: bump version to v4.48.1
karrui Dec 1, 2020
da7bc45
chore: log errors from concatResponse (#817)
tshuli Dec 9, 2020
5cd7078
chore: bump version to 4.48.2
mantariksh Dec 9, 2020
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
210 changes: 121 additions & 89 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ os: linux
dist: xenial

services:
- docker
- xvfb

language: node_js
node_js: '12'
cache:
- npm
- pip

addons:
chrome: stable
install: true # skip installation, perform in build stage.

notifications:
email:
Expand All @@ -23,90 +17,128 @@ notifications:
on_success: always
on_failure: always

before_script:
- export NODE_OPTIONS=--max-old-space-size=4096

script:
- set -e
- npm_config_mode=yes npx lockfile-lint --type npm --path package.json --validate-https --allowed-hosts npm
- npm run lint-ci
- npm run build
- travis_retry npm run test-ci
- npm run test-e2e-ci

before_deploy:
# Workaround to run before_deploy only once
- >
if ! [ "$TAG" ]; then
pip install --user awscli
# Put AWS in path
export PATH=$PATH:$HOME/.local/bin
# Login to AWS ECR, credentials defined in $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY
$(aws ecr get-login --no-include-email --region ap-southeast-1)
export TAG=travis-$TRAVIS_COMMIT-$TRAVIS_BUILD_NUMBER
docker build -f Dockerfile.production -t $REPO:$TAG .
docker tag $REPO:$TAG $REPO:$TRAVIS_BRANCH
docker push $REPO
# Add TAG to Dockerrun
sed -i -e "s/@TAG/$TAG/g" Dockerrun.aws.json
zip -r "$TAG.zip" .ebextensions Dockerrun.aws.json
fi
- export ELASTIC_BEANSTALK_LABEL="$TAG-$(env TZ=Asia/Singapore date "+%Y%m%d%H%M%S")"
jobs:
include:
- stage: Build application
install: npm ci
cache:
- npm
- pip
before_script:
- export NODE_OPTIONS=--max-old-space-size=4096
script:
- set -e
- npm_config_mode=yes npx lockfile-lint --type npm --path package.json --validate-https --allowed-hosts npm
- npm run lint-ci
- npm run build
workspaces:
create:
name: build
paths: .
- stage: Tests
name: Javascript tests
workspaces:
use: build
script:
- travis_retry npm run test-backend-jasmine
- npm run test-frontend
- name: Typescript tests
workspaces:
use: build
script:
- travis_retry npm run test-backend-jest
after_success:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
- name: End-to-end tests
workspaces:
use: build
addons:
chrome: stable
script:
- npm run test-e2e-ci
- stage: Deploy
services:
- docker
workspaces:
use: build
script: skip
before_deploy:
# Workaround to run before_deploy only once
- >
if ! [ "$TAG" ]; then
pip install --user awscli
# Put AWS in path
export PATH=$PATH:$HOME/.local/bin
# Login to AWS ECR, credentials defined in $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY
$(aws ecr get-login --no-include-email --region ap-southeast-1)
export TAG=travis-$TRAVIS_COMMIT-$TRAVIS_BUILD_NUMBER
docker build -f Dockerfile.production -t $REPO:$TAG .
docker tag $REPO:$TAG $REPO:$TRAVIS_BRANCH
docker push $REPO
# Add TAG to Dockerrun
sed -i -e "s/@TAG/$TAG/g" Dockerrun.aws.json
zip -r "$TAG.zip" .ebextensions Dockerrun.aws.json
fi
- export ELASTIC_BEANSTALK_LABEL="$TAG-$(env TZ=Asia/Singapore date "+%Y%m%d%H%M%S")"
deploy:
- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $STAGING_APP_NAME
env: $UAT_DEPLOY_ENV
bucket: $STAGING_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $UAT_BRANCH

deploy:
- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $STAGING_APP_NAME
env: $UAT_DEPLOY_ENV
bucket: $STAGING_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $UAT_BRANCH
- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $STAGING_APP_NAME
env: $STAGING_DEPLOY_ENV
bucket: $STAGING_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $STAGING_BRANCH

- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $STAGING_APP_NAME
env: $STAGING_DEPLOY_ENV
bucket: $STAGING_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $STAGING_BRANCH
- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $STAGING_APP_NAME
env: $STAGING_ALT_DEPLOY_ENV
bucket: $STAGING_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $STAGING_ALT_BRANCH

- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $STAGING_APP_NAME
env: $STAGING_ALT_DEPLOY_ENV
bucket: $STAGING_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $STAGING_ALT_BRANCH
- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $PROD_APP_NAME
env: $PROD_DEPLOY_ENV
bucket: $PROD_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $PROD_BRANCH

- provider: elasticbeanstalk
skip_cleanup: true
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
region: $AWS_REGION
app: $PROD_APP_NAME
env: $PROD_DEPLOY_ENV
bucket: $PROD_BUCKET_NAME
zip_file: '$TAG.zip'
on:
branch: $PROD_BRANCH
after_deploy:
- >
if [[ "$SENTRY_PROJECT" && "$SENTRY_AUTH_TOKEN" && "$SENTRY_ORG" && "$SENTRY_URL" ]]; then
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli releases --org $SENTRY_ORG --project $SENTRY_PROJECT new "$TAG"
sentry-cli releases files "$TAG" upload-sourcemaps ./ --rewrite --ignore-file .sentryignore
sentry-cli releases finalize "$TAG"
fi

after_deploy:
- >
if [[ "$SENTRY_PROJECT" && "$SENTRY_AUTH_TOKEN" && "$SENTRY_ORG" && "$SENTRY_URL" ]]; then
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli releases --org $SENTRY_ORG --project $SENTRY_PROJECT new "$TAG"
sentry-cli releases files "$TAG" upload-sourcemaps ./ --rewrite --ignore-file .sentryignore
sentry-cli releases finalize "$TAG"
fi
stages:
- Build application
- Tests
- Deploy
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,58 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v4.48.2](https://github.com/opengovsg/FormSG/compare/v4.48.1...v4.48.2)

- chore: log errors from concatResponse [`#817`](https://github.com/opengovsg/FormSG/pull/817)

#### [v4.48.1](https://github.com/opengovsg/FormSG/compare/v4.48.0...v4.48.1)

> 1 December 2020

- Revert "fix: backend validation does not prevent responses on hidden fields (#736)" [`fead8ce`](https://github.com/opengovsg/FormSG/commit/fead8ce6011003660d0269ceeffba8aaae09ab0a)
- chore: bump version to v4.48.1 [`7e6267d`](https://github.com/opengovsg/FormSG/commit/7e6267d6b291b2f43901ebf9266276823bfda580)
- fix: skip travis artifact cleanup [`3bb2d2b`](https://github.com/opengovsg/FormSG/commit/3bb2d2b2875d44dbbef93ecde30597584969ef3e)

#### [v4.48.0](https://github.com/opengovsg/FormSG/compare/v4.47.0...v4.48.0)

> 1 December 2020

- chore: add Go and Postman tips on Share tab [`#759`](https://github.com/opengovsg/FormSG/pull/759)
- fix: backend validation does not prevent responses on hidden fields [`#736`](https://github.com/opengovsg/FormSG/pull/736)
- fix(deps): bump mongoose from 5.10.15 to 5.10.18 [`#758`](https://github.com/opengovsg/FormSG/pull/758)
- fix(deps): bump celebrate from 13.0.3 to 13.0.4 [`#756`](https://github.com/opengovsg/FormSG/pull/756)
- chore(deps-dev): bump @types/mongoose from 5.10.0 to 5.10.1 [`#746`](https://github.com/opengovsg/FormSG/pull/746)
- chore(deps-dev): bump ts-mock-imports from 1.3.0 to 1.3.1 [`#747`](https://github.com/opengovsg/FormSG/pull/747)
- chore: update travis to have multiple ci stages [`#742`](https://github.com/opengovsg/FormSG/pull/742)
- ref: migrate get feedback flow to TypeScript [`#735`](https://github.com/opengovsg/FormSG/pull/735)
- fix(deps): bump opossum from 5.0.1 to 5.0.2 [`#738`](https://github.com/opengovsg/FormSG/pull/738)
- chore(deps-dev): bump @babel/preset-env from 7.12.1 to 7.12.7 [`#740`](https://github.com/opengovsg/FormSG/pull/740)
- chore(deps-dev): bump eslint from 7.13.0 to 7.14.0 [`#741`](https://github.com/opengovsg/FormSG/pull/741)
- ref: migrate stream feedback flow to TypeScript [`#733`](https://github.com/opengovsg/FormSG/pull/733)
- refactor(field-validation): simplify [`#734`](https://github.com/opengovsg/FormSG/pull/734)
- feat(utils): add exhaustive switch case typeguard [`#729`](https://github.com/opengovsg/FormSG/pull/729)
- feat: remove .oa file from allowed file types [`#731`](https://github.com/opengovsg/FormSG/pull/731)
- fix(deps): bump express-rate-limit from 5.1.3 to 5.2.3 [`#726`](https://github.com/opengovsg/FormSG/pull/726)
- fix(deps): bump angular-messages from 1.8.1 to 1.8.2 [`#725`](https://github.com/opengovsg/FormSG/pull/725)
- fix(deps): bump winston-cloudwatch from 2.3.2 to 2.4.0 [`#728`](https://github.com/opengovsg/FormSG/pull/728)
- refactor: migrate mobile number validator to ts [`#713`](https://github.com/opengovsg/FormSG/pull/713)
- chore(deps-dev): bump ts-jest from 26.4.1 to 26.4.4 [`#720`](https://github.com/opengovsg/FormSG/pull/720)
- refactor: migrate rating validator to ts [`#724`](https://github.com/opengovsg/FormSG/pull/724)
- refactor: migrate radio button validator to ts [`#723`](https://github.com/opengovsg/FormSG/pull/723)
- feat: migrate get encrypt metadata endpoint controller to TypeScript [`#711`](https://github.com/opengovsg/FormSG/pull/711)
- fix(AdminFormRoutes): add Joi validation on /submission endpoint [`#712`](https://github.com/opengovsg/FormSG/pull/712)
- chore(deps-dev): bump prettier from 2.1.2 to 2.2.0 [`#709`](https://github.com/opengovsg/FormSG/pull/709)
- chore(deps-dev): bump stylelint from 13.6.1 to 13.8.0 [`#721`](https://github.com/opengovsg/FormSG/pull/721)
- chore(deps-dev): bump lint-staged from 10.5.1 to 10.5.2 [`#722`](https://github.com/opengovsg/FormSG/pull/722)
- docs: add script for unlisting array of forms [`#714`](https://github.com/opengovsg/FormSG/pull/714)
- build: merge release 4.47.0 into develop [`#719`](https://github.com/opengovsg/FormSG/pull/719)
- fix: convert field ID to string for admin preview MyInfo [`#717`](https://github.com/opengovsg/FormSG/pull/717)
- chore: bump version to v4.48.0 [`24866f6`](https://github.com/opengovsg/FormSG/commit/24866f66ae6c95f56ab59a7f5e0cc7db6ba1121a)

#### [v4.47.0](https://github.com/opengovsg/FormSG/compare/v4.46.1...v4.47.0)

> 24 November 2020

- feat: Increase attachment size options [`#692`](https://github.com/opengovsg/FormSG/pull/692)
- ref: migrate feedback/count endpoint handler flow to TypeScript [`#706`](https://github.com/opengovsg/FormSG/pull/706)
- chore(deps-dev): bump sinon from 9.2.0 to 9.2.1 [`#710`](https://github.com/opengovsg/FormSG/pull/710)
Expand Down Expand Up @@ -43,6 +93,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix(deps): bump axios from 0.20.0 to 0.21.0 [`#658`](https://github.com/opengovsg/FormSG/pull/658)
- chore(deps-dev): bump lint-staged from 10.4.0 to 10.5.1 [`#657`](https://github.com/opengovsg/FormSG/pull/657)
- build: add lockfile-lint to CI [`#651`](https://github.com/opengovsg/FormSG/pull/651)
- chore: bump version to 4.47.0 [`f334474`](https://github.com/opengovsg/FormSG/commit/f334474fd5c251b683f0c78fcb5af643d7cc30cd)
- chore: bump version to v4.46.1 [`375df4f`](https://github.com/opengovsg/FormSG/commit/375df4f23a4a9253a50df6bdb1905cfcb40d83f2)
- fix: early return on undefined verification signature [`e67bb8b`](https://github.com/opengovsg/FormSG/commit/e67bb8b1fc12e41c7c9cf1347a52ed7e30f2fbf5)

Expand Down
28 changes: 28 additions & 0 deletions docs/MONGODB.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ function unlistFormFromExamples(id) {
// unlistFormFromExamples("form id")
```

```javascript
/**
* Unlist an array of forms from the examples page
* @param {String[]} ids of the forms. These can be any string
* where the first sequence of 24 consecutive alphanumerics is the
* form ID, e.g. the form link.
*/
function unlistFormArrayFromExamples(ids) {
const formIdRegex = /[0-9a-fA-F]{24}/
// Wrap all ids in ObjectId
const objectIds = []
for (let id of ids) {
const parsed = formIdRegex.exec(id)
if (parsed) {
objectIds.push(ObjectId(parsed[0]))
} else {
throw new Error(`${id} does not contain a valid form ID.`)
}
}
const result = db
.getCollection('forms')
.updateMany({ _id: { $in: objectIds } }, { $set: { isListed: false } })
return `${ids.length} forms given, ${result.matchedCount} matched, ${result.modifiedCount} modified`
}
// const ids = ['https://some.url/5f8817b7bde9d4002a800d78', 'some.url/#!/5f9a587b119c07002b56124f']
// unlistFormArrayFromExamples(ids)
```

- **Create new agency**

```javascript
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ module.exports = {
},
collectCoverageFrom: ['./src/**/*.{ts,js}', '!**/__tests__/**'],
coveragePathIgnorePatterns: ['./node_modules/', './tests'],
coverageReporters: ['lcov', 'text'],
coverageThreshold: {
global: {
statements: 25, // Increase this percentage as test coverage improves
},
},
testEnvironment: 'node',
}
Loading