-
Notifications
You must be signed in to change notification settings - Fork 3
/
cloudbuild.yaml
57 lines (51 loc) · 1.66 KB
/
cloudbuild.yaml
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
57
steps:
- name: 'gcr.io/cloud-builders/gcloud'
id: Generate manifest
entrypoint: 'bash'
args:
- '-c'
- |
sed "s#_PROJECT_ID#${_PROJECT_ID}#g" appengine_templates/app.yaml.tpl | \
sed "s#_VM_INTERNAL_URL#${_VM_INTERNAL_URL}#g" | \
sed "s#_VM_EXTERNAL_WEB_URL#${_VM_EXTERNAL_WEB_URL}#g" | \
sed "s#_VM_EXTERNAL_CLIENT_URL#${_VM_EXTERNAL_CLIENT_URL}#g" | \
sed "s#_BLAISE_API_URL#${_BLAISE_API_URL}#g" > app.yaml
- name: 'gcr.io/cloud-builders/gcloud'
id: Print Output
entrypoint: /bin/sh
args:
- '-c'
- |
cat app.yaml
- name: "gcr.io/cloud-builders/gcloud"
id: Deploy service
args: ["app", "deploy"]
timeout: "1600s"
- name: 'gcr.io/cloud-builders/gcloud'
id: Clean Up Old Versions
entrypoint: 'bash'
args:
- '-c'
- |
versions=$(gcloud app versions list --service "tobi-ui" --sort-by '~version' --format 'value(VERSION.ID)' --project "${_PROJECT_ID}" | tail -n +11)
versions=($versions) # split to array $versions
for (( i=0; i<${#versions[@]}; i++ ))
do
gcloud app versions delete ${versions[$i]} --service "tobi-ui" --project "${_PROJECT_ID}" --quiet
done
- name: "gcr.io/cloud-builders/gcloud"
id: "Slack Notify"
waitFor: ["Deploy service"]
entrypoint: "/bin/bash"
args:
- "-c"
- |
python3 -u slack/slack-notify.py;
env:
- 'PROJECT_ID=$PROJECT_ID'
- 'BUILD_ID=$BUILD_ID'
- 'REPO_NAME=$REPO_NAME'
- 'COMMIT_SHA=$COMMIT_SHA'
- 'SHORT_SHA=$SHORT_SHA'
- 'SLACK_CHANNEL=$_SLACK_CHANNEL'
- 'SLACK_WEBHOOK=$_SLACK_WEBHOOK'