Skip to content

Commit dde6995

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 9c2ec13 + 029bd80 commit dde6995

File tree

153 files changed

+3598
-63471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3598
-63471
lines changed

.github/workflows/deploy.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Deploy to production
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- releases/v1
7+
types:
8+
- opened
9+
- synchronize
10+
- reopened
11+
- closed
12+
13+
env:
14+
# Required for action steebchen/kubectl
15+
KUBE_CONFIG_DATA: ${{ secrets.kubeconfig_data_prod }}
16+
17+
jobs:
18+
show-changes:
19+
if: github.event.pull_request.state != 'closed'
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: azure/setup-kubectl@v1
25+
with:
26+
version: v1.18.0
27+
28+
- name: Get resource diffs
29+
run: |
30+
set -e
31+
comment_file=/tmp/k8s_diff.txt
32+
app_manifest=k8s/app.yaml
33+
prod_manifest_dir=k8s.prod
34+
35+
test -e ~/.kube || mkdir ~/.kube
36+
cat <<EOF > ~/.kube/config
37+
$(printf '%s' "$KUBE_CONFIG_DATA" | base64 -d)
38+
EOF
39+
40+
app_diff=$(kubectl diff -f $app_manifest || true)
41+
if [ -n "$app_diff" ]; then
42+
app_diff_msg=$(cat <<EOF
43+
To be applied to prod from $app_manifest:
44+
\`\`\`diff
45+
$app_diff
46+
\`\`\`
47+
48+
EOF)
49+
fi
50+
51+
prod_diff=$(kubectl diff -Rf $prod_manifest_dir || true)
52+
if [ -n "$prod_diff" ]; then
53+
prod_diff_msg=$(cat <<EOF
54+
To be applied to prod from $prod_manifest_dir:
55+
\`\`\`diff
56+
$prod_diff
57+
\`\`\`
58+
59+
EOF)
60+
fi
61+
62+
cat <<EOF > $comment_file
63+
$app_diff_msg
64+
$prod_diff_msg
65+
EOF
66+
67+
- uses: actions/upload-artifact@v1
68+
with:
69+
name: comment
70+
path: /tmp/k8s_diff.txt
71+
- uses: actions/download-artifact@v1
72+
with:
73+
name: comment
74+
75+
- name: Publish resource diffs
76+
uses: machine-learning-apps/[email protected]
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
with:
80+
path: comment/k8s_diff.txt
81+
82+
deploy-prod:
83+
if: github.event.pull_request.merged
84+
runs-on: ubuntu-latest
85+
86+
steps:
87+
- uses: actions/checkout@v2
88+
89+
- name: Deploy to prod
90+
uses: steebchen/[email protected]
91+
with:
92+
args: apply -f k8s/app.yaml
93+
94+
- name: Sync prod resources
95+
uses: steebchen/[email protected]
96+
with:
97+
args: apply -Rf k8s.prod
98+
99+
- name: Wait for deploy to complete
100+
uses: steebchen/[email protected]
101+
with:
102+
args: -n chime rollout status deployment.v1.apps/chime
103+
104+
- name: Show completed deployment
105+
uses: steebchen/[email protected]
106+
with:
107+
args: -n chime get deployment chime -o yaml

.github/workflows/dockerpublish.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111

1212
env:
1313
IMAGE_NAME: penn-chime
14+
DEPLOY_PUSH_BRANCH: develop
15+
# Required for action steebchen/kubectl
16+
KUBE_CONFIG_DATA: ${{ secrets.kubeconfig_data_preprod }}
1417

1518
jobs:
1619
# Run tests.
@@ -66,3 +69,60 @@ jobs:
6669
6770
docker tag image $IMAGE_ID:$VERSION
6871
docker push $IMAGE_ID:$VERSION
72+
73+
deploy-preprod:
74+
75+
needs: push
76+
if: github.event_name == 'push'
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- uses: actions/checkout@v2
81+
with:
82+
fetch-depth: 0 # Needed for proper rebase
83+
- name: Update application manifest
84+
run: |
85+
# Strip git ref prefix from version
86+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
87+
88+
# Strip "v" prefix from tag name
89+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
90+
91+
# Pass version to subsequent steps
92+
echo "::set-env name=VERSION::$VERSION"
93+
94+
# Update image version in application manifest
95+
sed -Ei "s,(- image: docker.pkg.github.com)(.*),\1/${GITHUB_REPOSITORY,,}/$IMAGE_NAME:$VERSION," k8s/app.yaml
96+
97+
# Show updated manifest file
98+
cat k8s/app.yaml
99+
100+
- name: Deploy to preprod
101+
uses: steebchen/[email protected]
102+
with:
103+
args: apply -f k8s/app.yaml
104+
105+
- name: Sync preprod resources
106+
uses: steebchen/[email protected]
107+
with:
108+
args: apply -Rf k8s.preprod
109+
110+
- name: Wait for deploy to complete
111+
uses: steebchen/[email protected]
112+
with:
113+
args: -n chime rollout status deployment.v1.apps/chime
114+
115+
- name: Show completed deployment
116+
uses: steebchen/[email protected]
117+
with:
118+
args: -n chime get deployment chime -o yaml
119+
120+
- name: Push manifest update
121+
uses: github-actions-x/[email protected]
122+
with:
123+
github-token: ${{ secrets.GITHUB_TOKEN }}
124+
push-branch: ${{ env.DEPLOY_PUSH_BRANCH }}
125+
commit-message: "chore: bump k8s manifest up CHIME ${{ env.VERSION }}"
126+
rebase: 'true'
127+
name: Chime CI
128+

.github/workflows/pythonapp.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ jobs:
4444
uses: cypress-io/[email protected]
4545
with:
4646
working-directory: e2e
47+
wait-on: 'http://localhost:8000'
48+
wait-on-timeout: 300
4749

Dockerfile.dash

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ FROM python:3.7.7-slim-buster
22

33
WORKDIR /code
44

5+
ARG PORT
6+
ENV PORT $PORT
7+
58
COPY requirements.txt requirements.txt
6-
RUN pip install -q -r requirements.txt
9+
RUN pip install -r requirements.txt
710

811
COPY src src
912

Pipfile.lock

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

date_first_hospitalized.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--current-hospitalized 14
2+
--date-first-hospitalized 2020-03-07
3+
--hospitalized-los 7
4+
--hospitalized-rate 0.025
5+
--icu-los 9
6+
--icu-rate 0.0075
7+
--infectious-days 14
8+
--known-infected 510
9+
--market_share 0.15
10+
--n-days 60
11+
--population 4119405
12+
--relative-contact-rate 0.3
13+
--ventilated-los 10
14+
--ventilated-rate 0.005

docker-compose-dash.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.1'
2+
3+
services:
4+
app:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile.dash
8+
args:
9+
- PORT=${PORT}
10+
restart: always
11+
ports:
12+
- "${PORT}:8000"

docs/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
- [Data Analysis](contributing/data-analysis.md)
1010
- [Operations Support](contributing/operations-support.md)
1111
- Operations
12-
- [Release Process](./operations/release-process.md)
12+
- [Preparing a new release](./operations/prepare-new-chime-release.md)
13+
- [Release Process](./operations/release=process.md)
1314
- [The `chime-live` Cluster](./operations/chime-live-cluster.md)
1415
- [Deploy to Heroku](./operations/heroku.md)
1516
- [Deploy with Chef Habitat](./operations/habitat.md)

0 commit comments

Comments
 (0)