Skip to content

Commit

Permalink
Merge pull request #954 from isomerpages/release/0.45.0
Browse files Browse the repository at this point in the history
Release/0.45.0
  • Loading branch information
alexanderleegs authored Oct 5, 2023
2 parents 47db1f9 + cecaaca commit 7553fdd
Show file tree
Hide file tree
Showing 26 changed files with 1,612 additions and 638 deletions.
3 changes: 2 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export SYSTEM_GITHUB_TOKEN="github_token"
# FormSG keys
export SITE_CREATE_FORM_KEY="site_form_key"
export SITE_LAUNCH_FORM_KEY="site_launch_form_key"
export SITE_CLONE_FORM_KEY="site_clone_form_key"

# Required to connect to DynamoDB
export AWS_ACCESS_KEY_ID="abc123"
Expand Down Expand Up @@ -81,4 +82,4 @@ export SGID_PRIVATE_KEY="private"
export SGID_REDIRECT_URI="http://localhost:8081/v2/auth/sgid/auth-redirect"

# GrowthBook
export GROWTHBOOK_CLIENT_KEY="some random key"
export GROWTHBOOK_CLIENT_KEY="some random key"
3 changes: 2 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Closes [insert issue #]

- [ ] Yes - this PR contains breaking changes
- Details ...
- [ ] No - this PR is backwards compatible
- [ ] No - this PR is backwards compatible with ALL of the following feature flags in this [doc](https://www.notion.so/opengov/Existing-feature-flags-518ad2cdc325420893a105e88c432be5)

**Features**:

Expand Down Expand Up @@ -50,6 +50,7 @@ Closes [insert issue #]
**New environment variables**:

- `env var` : env var details
- [ ] added env var to 1PW + SSM script (`fetch_ssm_parameters.sh`)

**New scripts**:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
STAGING_BRANCH: refs/heads/staging
EB_APP: isomer-cms
EB_ENV_PRODUCTION: cms-backend-prod-node16
EB_ENV_STAGING: cms-backend-staging-node16
EB_ENV_STAGING: cms-backend-staging-node18
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}

jobs:
Expand Down
143 changes: 72 additions & 71 deletions .platform/hooks/predeploy/06_fetch_ssm_parameters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,100 +20,101 @@ fi
ENV_TYPE=$(/opt/elasticbeanstalk/bin/get-config environment -k SSM_PREFIX)
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')

echo "Timestamp: $TIMESTAMP - ENV TYPE: $ENV_TYPE" > /tmp/ssm-type.txt
echo "Timestamp: $TIMESTAMP - ENV TYPE: $ENV_TYPE" >/tmp/ssm-type.txt

# List of all env vars to fetch
ENV_VARS=(
"AUTH_TOKEN_EXPIRY_DURATION_IN_MILLISECONDS"
"AWS_BACKEND_EB_ENV_NAME"
"AWS_REGION"
"CLIENT_ID"
"CLIENT_SECRET"
"CLOUDMERSIVE_API_KEY"
"COOKIE_DOMAIN"
"DB_ACQUIRE"
"DB_MAX_POOL"
"DB_MIN_POOL"
"DB_TIMEOUT"
"DB_URI"
"DD_AGENT_MAJOR_VERSION"
"DD_ENV"
"DD_LOGS_INJECTION"
"DD_SERVICE"
"DD_TAGS"
"DD_TRACE_STARTUP_LOGS"
"E2E_TEST_GH_TOKEN"
"E2E_TEST_REPO"
"E2E_TEST_SECRET"
"EFS_VOL_PATH"
"ENCRYPTION_SECRET"
"FF_DEPRECATE_SITE_QUEUES"
"FRONTEND_URL"
"GGS_EXPERIMENTAL_TRACKING_SITES"
"GITHUB_BUILD_ORG_NAME"
"GITHUB_BUILD_REPO_NAME"
"GITHUB_ORG_NAME"
"GROWTHBOOK_CLIENT_KEY"
"INCOMING_QUEUE_URL"
"ISOMERPAGES_REPO_PAGE_COUNT"
"JWT_SECRET"
"MAX_NUM_OTP_ATTEMPTS"
"MOCK_AMPLIFY_DOMAIN_ASSOCIATION_CALLS"
"MUTEX_TABLE_NAME"
"NETLIFY_ACCESS_TOKEN"
"NODE_ENV"
"OTP_EXPIRY"
"OTP_SECRET"
"OUTGOING_QUEUE_URL"
"POSTMAN_API_KEY"
"POSTMAN_SMS_CRED_NAME"
"REDIRECT_URI"
"SESSION_SECRET"
"SGID_CLIENT_ID"
"SGID_CLIENT_SECRET"
"SGID_PRIVATE_KEY"
"SGID_REDIRECT_URI"
"SITE_CREATE_FORM_KEY"
"SITE_LAUNCH_DYNAMO_DB_TABLE_NAME"
"SITE_LAUNCH_FORM_KEY"
"SITE_PASSWORD_SECRET_KEY"
"SSM_PREFIX"
"STEP_FUNCTIONS_ARN"
"SYSTEM_GITHUB_TOKEN"
"AUTH_TOKEN_EXPIRY_DURATION_IN_MILLISECONDS"
"AWS_BACKEND_EB_ENV_NAME"
"AWS_REGION"
"CLIENT_ID"
"CLIENT_SECRET"
"CLOUDMERSIVE_API_KEY"
"COOKIE_DOMAIN"
"DB_ACQUIRE"
"DB_MAX_POOL"
"DB_MIN_POOL"
"DB_TIMEOUT"
"DB_URI"
"DD_AGENT_MAJOR_VERSION"
"DD_ENV"
"DD_LOGS_INJECTION"
"DD_SERVICE"
"DD_TAGS"
"DD_TRACE_STARTUP_LOGS"
"E2E_TEST_GH_TOKEN"
"E2E_TEST_REPO"
"E2E_TEST_SECRET"
"EFS_VOL_PATH"
"ENCRYPTION_SECRET"
"FF_DEPRECATE_SITE_QUEUES"
"FRONTEND_URL"
"GGS_EXPERIMENTAL_TRACKING_SITES"
"GITHUB_BUILD_ORG_NAME"
"GITHUB_BUILD_REPO_NAME"
"GITHUB_ORG_NAME"
"GROWTHBOOK_CLIENT_KEY"
"INCOMING_QUEUE_URL"
"ISOMERPAGES_REPO_PAGE_COUNT"
"JWT_SECRET"
"MAX_NUM_OTP_ATTEMPTS"
"MOCK_AMPLIFY_DOMAIN_ASSOCIATION_CALLS"
"MUTEX_TABLE_NAME"
"NETLIFY_ACCESS_TOKEN"
"NODE_ENV"
"OTP_EXPIRY"
"OTP_SECRET"
"OUTGOING_QUEUE_URL"
"POSTMAN_API_KEY"
"POSTMAN_SMS_CRED_NAME"
"REDIRECT_URI"
"SESSION_SECRET"
"SGID_CLIENT_ID"
"SGID_CLIENT_SECRET"
"SGID_PRIVATE_KEY"
"SGID_REDIRECT_URI"
"SITE_CREATE_FORM_KEY"
"SITE_LAUNCH_DYNAMO_DB_TABLE_NAME"
"SITE_LAUNCH_FORM_KEY"
"SITE_CLONE_FORM_KEY"
"SITE_PASSWORD_SECRET_KEY"
"SSM_PREFIX"
"STEP_FUNCTIONS_ARN"
"SYSTEM_GITHUB_TOKEN"
)

echo "Set AWS region"
aws configure set default.region ap-southeast-1

set +e # Do not exit if a command fails
set +e # Do not exit if a command fails

for ENV_VAR in "${ENV_VARS[@]}"; do
echo "Fetching ${ENV_VAR} from SSM"

VALUE=$(aws ssm get-parameter --name "${ENV_TYPE}_${ENV_VAR}" --with-decryption --query "Parameter.Value" --output text 2>/dev/null)
STATUS=$? # Capture exit status of the aws ssm command
STATUS=$? # Capture exit status of the aws ssm command

if [ $STATUS -ne 0 ]; then
echo "Failed to fetch ${ENV_VAR}. Skipping."
continue
fi
echo "${ENV_VAR}=${VALUE}" >> /tmp/isomer/.isomer.env

echo "${ENV_VAR}=${VALUE}" >>/tmp/isomer/.isomer.env
echo "Saved ${ENV_VAR}"
done

set -e # Exit on command failure from this point onwards
set -e # Exit on command failure from this point onwards

# Use flock to ensure that the EFS file is locked during the copy operation
(
flock -n 200 || exit 1
flock -n 200 || exit 1

# Copy the local file to EFS
echo "Copying local env file to EFS"
cp /tmp/isomer/.isomer.env /efs/isomer/.isomer.env
# Copy the local file to EFS
echo "Copying local env file to EFS"
cp /tmp/isomer/.isomer.env /efs/isomer/.isomer.env

# Ensure the file on EFS is owned by webapp so it has access
chown webapp:webapp /efs/isomer/.isomer.env
# Ensure the file on EFS is owned by webapp so it has access
chown webapp:webapp /efs/isomer/.isomer.env

) 200>/efs/isomer/.isomer.lock

Expand All @@ -126,4 +127,4 @@ else
echo "Couldn't acquire the lock. Another instance might be writing to the file."
fi

echo "Operation completed."
echo "Operation completed."
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ 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).

#### [v0.45.0](https://github.com/isomerpages/isomercms-backend/compare/v0.44.0...v0.45.0)

- fix(clonesite): remove extra endpoint [`#956`](https://github.com/isomerpages/isomercms-backend/pull/956)
- feat(formsg): clone repo on webhook trigger from forms [`#947`](https://github.com/isomerpages/isomercms-backend/pull/947)
- docs(pr-template): add checkbox for ssm and 1pw for env var [`#953`](https://github.com/isomerpages/isomercms-backend/pull/953)
- feat: add new admin endpoint to reset repository [`#950`](https://github.com/isomerpages/isomercms-backend/pull/950)
- IS-621: fix issues for staging deploy node 18 [`#951`](https://github.com/isomerpages/isomercms-backend/pull/951)
- feat: add ability to update repo state for GGS [`#949`](https://github.com/isomerpages/isomercms-backend/pull/949)
- feat(template): add ffs as a manual check-in [`#933`](https://github.com/isomerpages/isomercms-backend/pull/933)
- Release/0.44.0 [re-merge] [`#946`](https://github.com/isomerpages/isomercms-backend/pull/946)

#### [v0.44.0](https://github.com/isomerpages/isomercms-backend/compare/v0.43.0...v0.44.0)

> 20 September 2023
- IS-412: Move fetching SSM params to prebuild [`#943`](https://github.com/isomerpages/isomercms-backend/pull/943)
- 0.43.0 [`#941`](https://github.com/isomerpages/isomercms-backend/pull/941)

Expand All @@ -24,12 +37,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix(sl): add retries when creating indirection domain [`#935`](https://github.com/isomerpages/isomercms-backend/pull/935)
- Fix/e2e mutex [`#934`](https://github.com/isomerpages/isomercms-backend/pull/934)
- release(v0.41.0): merge to `develop` [`#929`](https://github.com/isomerpages/isomercms-backend/pull/929)
- Hotfix - Staging E2E, Tests [`#931`](https://github.com/isomerpages/isomercms-backend/pull/931)

#### [v0.41.0](https://github.com/isomerpages/isomercms-backend/compare/v0.40.1...v0.41.0)

> 30 August 2023
- Hotfix - Staging E2E, Tests [`#931`](https://github.com/isomerpages/isomercms-backend/pull/931)
- IS-310: Setup GrowthBook for BE [`#926`](https://github.com/isomerpages/isomercms-backend/pull/926)
- fix: upgrade aws-sdk from 2.1416.0 to 2.1428.0 [`#921`](https://github.com/isomerpages/isomercms-backend/pull/921)
- feat(sl): enhance site launch process to utilise DNS indirection layer [`#920`](https://github.com/isomerpages/isomercms-backend/pull/920)
Expand Down
Loading

0 comments on commit 7553fdd

Please sign in to comment.