Skip to content

Commit

Permalink
Merge pull request #4009 from opengovsg/release-5.61.0
Browse files Browse the repository at this point in the history
build: merge release 5.61.0 into master
  • Loading branch information
karrui authored Jun 22, 2022
2 parents 0fac0e5 + 9361558 commit b5c53a0
Show file tree
Hide file tree
Showing 162 changed files with 19,902 additions and 9,854 deletions.
87 changes: 87 additions & 0 deletions .ebextensions/99datadog-amazon-linux-2.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# .ebextensions/99datadog-amazon-linux-2.config
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: DD_API_KEY
value: "<YOUR_DD_API_KEY>" # To set in AWS EB console only
- namespace: aws:elasticbeanstalk:application:environment
option_name: DD_AGENT_VERSION
value: "7.31.0"
- namespace: aws:elasticbeanstalk:application:environment
option_name: DD_ENV
value: "staging" # staging | production
files:
"/configure_datadog_yaml.sh":
mode: "000700"
owner: root
group: root
content: |
#!/bin/bash

sed -e "s/api_key:.*/api_key: ${DD_API_KEY}/" \
-e "s/# dogstatsd_non_local_traffic: false/dogstatsd_non_local_traffic: true/" \
-e "s/# hostname_file:/hostname_file:/" \
/etc/datadog-agent/datadog.yaml.example > /etc/datadog-agent/datadog.yaml

# Use the following command if you're in the EU. Replace datadoghq.eu with another region if in a different region.
# sed -i 's/datadoghq.com/datadoghq.eu/' /etc/datadog-agent/datadog.yaml

echo "tags:" >> /etc/datadog-agent/datadog.yaml
echo " - service:formsg" >> /etc/datadog-agent/datadog.yaml
echo " - env:${DD_ENV}" >> /etc/datadog-agent/datadog.yaml
"/datadog/datadog.repo":
mode: "000644"
owner: root
group: root
content: |
[datadog]
name = Datadog, Inc.
baseurl = https://yum.datadoghq.com/stable/7/x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public
https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public
https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public

"/start_datadog.sh":
mode: "000700"
owner: root
group: root
content: |
#!/bin/bash
STATUS=$(sudo systemctl status datadog-agent)
if [[ "$STATUS" == *"active (running)"* ]]
then
echo "Agent already running"
else
echo "Agent starting..."
sudo systemctl start datadog-agent
fi

"/stop_datadog.sh":
mode: "000700"
owner: root
group: root
content: |
#!/bin/bash
STATUS=$(sudo systemctl status datadog-agent)
if [[ "$STATUS" == *"active (running)"* ]]
then
echo "Agent stopping..."
sudo systemctl stop datadog-agent
else
echo "Agent already stopped"
fi


container_commands:
02stop_datadog:
command: "/stop_datadog.sh"
04install_datadog:
test: '[ -f /datadog/datadog.repo ]'
command: 'cp /datadog/datadog.repo /etc/yum.repos.d/datadog.repo; yum -y makecache; yum -y install datadog-agent${DD_AGENT_VERSION:+-$DD_AGENT_VERSION-1}'
05setup_datadog:
test: '[ -x /configure_datadog_yaml.sh ]'
command: "/configure_datadog_yaml.sh"
06start_datadog:
command: "/start_datadog.sh"
111 changes: 0 additions & 111 deletions .ebextensions/99datadog.config

This file was deleted.

2 changes: 1 addition & 1 deletion .ebextensions/eb-memory-monitor.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packages:
perl-LWP-Protocol-https: []
perl-Switch: []
perl-URI: []
perl-Bundle-LWP: [] # TODO(#638): Replace this yum package with perl-Digest-SHA.x86_64 for Amazon Linux 2 instances
perl-Digest-SHA.x86_64: []
sources:
/opt/cloudwatch: https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.1.zip

Expand Down
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ updates:
prefix: 'fix'
prefix-development: 'chore'
include: 'scope'
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/shared' # Location of package manifests
schedule:
interval: 'daily'
time: '03:00'
timezone: 'Asia/Singapore'
commit-message:
prefix: 'fix'
prefix-development: 'chore'
include: 'scope'
2 changes: 2 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pull_request_rules:
- check-success~=build
- check-success~=test-frontend
- check-success~=test-backend
- check-success~=test-e2e
- check-success~=Analyze # CodeQL / Analyze
- check-success~=CodeQL # CodeQL code scanning results
- check-success~=GitGuardian
Expand All @@ -25,6 +26,7 @@ pull_request_rules:
- check-success~=build
- check-success~=test-frontend
- check-success~=test-backend
- check-success~=test-e2e
- check-success~=Analyze # CodeQL / Analyze
- check-success~=CodeQL # CodeQL code scanning results
- check-success~=GitGuardian
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: CI

on:
push:
pull_request_target:
types: [opened, reopened]
pull_request:
branches: [develop]
types: [opened, reopened]

jobs:
Expand Down Expand Up @@ -64,6 +63,24 @@ jobs:
- run: npm ci
- run: npm run build

test-e2e:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Load Node.js modules
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- run: npm run test-e2e

test-frontend:
needs: lint
runs-on: ubuntu-latest
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/deploy-eb.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Deploy to AWS Elastic Beanstalk
on:
push:
branches: # There should be 4 environments in github actions secrets: release, staging, staging-alt, uat. This is different from the DEPLOY_ENV secret which corresponds to elastic beanstalk environment name
# There should be 6 environments in github actions secrets:
# release, release-al2, staging, staging-al2, staging-alt, uat.
# This is different from the DEPLOY_ENV secret which corresponds to elastic beanstalk environment name.
branches:
- release
- release-al2
- staging
- staging-al2
- staging-alt
- uat

Expand Down Expand Up @@ -33,6 +38,9 @@ jobs:
- name: Build
env:
NODE_OPTIONS: '--max-old-space-size=4096'
REACT_APP_DD_RUM_APP_ID: ${{ secrets.DD_RUM_APP_ID }}
REACT_APP_DD_RUM_CLIENT_TOKEN: ${{ secrets.DD_RUM_CLIENT_TOKEN }}
REACT_APP_DD_RUM_ENV: ${{ secrets.DEPLOY_ENV }}
run: |
npm ci
set -e
Expand All @@ -54,11 +62,14 @@ jobs:
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REPOSITORY: ${{ secrets.ECR_REPO }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_ENV: ${{ secrets.DEPLOY_ENV }}
run: |
docker build -f Dockerfile.production -t $ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REPOSITORY:$IMAGE_TAG $ECR_REPOSITORY:$BRANCH
docker push -a $ECR_REPOSITORY
sed -i -e "s/@TAG/$IMAGE_TAG/g" Dockerrun.aws.json
sed -i -e "s/@TAG/$IMAGE_TAG/g" Dockerrun.aws.json
sed -i -e "s/@DD_API_KEY/$DD_API_KEY/g" -e "s/@DD_ENV/$DEPLOY_ENV/g" .ebextensions/99datadog-amazon-linux-2.config
zip -r "$IMAGE_TAG.zip" .ebextensions Dockerrun.aws.json
- name: Copy to S3
Expand All @@ -72,7 +83,7 @@ jobs:
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
APP_NAME: ${{ secrets.APP_NAME }}
run: |
TRUNCATED_DESC=$(echo "${{github.event.head_commit.message}}" | cut -b1-180)
TRUNCATED_DESC=$(echo "${{github.event.head_commit.message}}" | head -c 180)
aws elasticbeanstalk create-application-version --application-name $APP_NAME \
--version-label $IMAGE_TAG \
--source-bundle S3Bucket=$BUCKET_NAME,S3Key=$IMAGE_TAG.zip \
Expand Down
Loading

0 comments on commit b5c53a0

Please sign in to comment.