forked from datacommonsorg/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.deploy.yaml
More file actions
56 lines (52 loc) · 1.68 KB
/
cloudbuild.deploy.yaml
File metadata and controls
56 lines (52 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
steps:
- id: package_js
name: "node"
entrypoint: /bin/bash
args:
- -c
- |
set -x
./run_test.sh -lbc
- id: flask_test
name: python:3.7-slim
entrypoint: /bin/sh
args:
- -c
- |
set -x
./run_test.sh -p
- id: deploy
name: "gcr.io/cloud-builders/gcloud"
entrypoint: /bin/bash
args:
- -c
- |
set -x
cd server
gcloud config set project datcom-browser-staging
# bdist_wheel for grpcio takes a long time, setting timeout to be 1200s
gcloud config set app/cloud_build_timeout 1200
gcloud app deploy app_staging.yaml -q --version=$SHORT_SHA
# Keep at most 5 recent versions
if [[ "$(gcloud app versions list | wc -l)" -gt 6 ]]; then
echo "Remove the oldest version..."
gcloud app versions delete -q \
`gcloud app versions list --sort-by=~LAST_DEPLOYED | sed 's/ */:/g' | cut -f 2 -d : | tail -1 | tr "\n" " "`
fi
- id: update version
name: "gcr.io/cloud-builders/git"
entrypoint: /bin/bash
args:
- -c
- |
set -x
gcloud source repos clone deployment --project=datcom-ci
cd deployment
# Configure Git to create commits with Cloud Build's service account
git config user.email $(gcloud auth list --filter=status:ACTIVE --format='value(account)')
git checkout master
echo $SHORT_SHA > website/staging/commit_hash.txt
git add website/staging/commit_hash.txt
git commit -m "Deployed website to staging at commit https://github.com/datacommonsorg/website/commit/$SHORT_SHA"
git push origin master
timeout: 3600s