-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
114 lines (96 loc) · 3.21 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
steps:
# Create a copy of the repo, so that steps can get their own fresh copy if
# necessary.
- name: ubuntu
id: 'sandbox'
volumes:
- name: 'sandbox'
path: '/sandbox'
args: ['bash', '-c', 'mkdir -p "/sandbox" && cp -r . "/sandbox/repo"']
# Tests
- name: gcr.io/cloud-builders/gcloud
id: 'secrets'
entrypoint: 'bash'
args: ['server/scripts/get_secrets']
waitFor: ['sandbox']
- name: golang:1.14
id: 'server.validate'
volumes:
- name: 'sandbox'
path: '/sandbox'
args: ['server/scripts/validate', '/sandbox/validate', '/sandbox/repo']
waitFor: ['sandbox']
- name: golang:1.14
id: 'server.lint'
volumes:
- name: 'sandbox'
path: '/sandbox'
args: ['server/scripts/lint', '/sandbox/lint', '/sandbox/repo']
waitFor: ['sandbox']
- name: golang:1.14
id: 'server.test'
args: ['make', 'test']
dir: 'server'
waitFor: ['sandbox']
- name: 'gcr.io/cloud-builders/docker'
id: 'server.build.gateway'
args: ['build', '-f', 'Dockerfile.gateway', '-t', 'gcr.io/${PROJECT_ID}/kript-gateway:${SHORT_SHA}', '.']
dir: 'server'
waitFor: ['sandbox', 'secrets']
- name: 'gcr.io/cloud-builders/docker'
id: 'server.build.grpc'
args: ['build', '-f', 'Dockerfile.grpc', '-t', 'gcr.io/${PROJECT_ID}/kript-grpc:${SHORT_SHA}', '.']
dir: 'server'
waitFor: ['sandbox', 'secrets']
- name: 'gcr.io/cloud-builders/docker'
id: 'server.build.account'
args: ['build', '-f', 'Dockerfile.account', '-t', 'gcr.io/${PROJECT_ID}/kript-account:${SHORT_SHA}', '.']
dir: 'server'
waitFor: ['sandbox', 'secrets']
- name: 'gcr.io/cloud-builders/docker'
id: 'server.build.data'
args: ['build', '-f', 'Dockerfile.data', '-t', 'gcr.io/${PROJECT_ID}/kript-data:${SHORT_SHA}', '.']
dir: 'server'
waitFor: ['sandbox', 'secrets']
- name: node
id: 'client.web.install'
entrypoint: npm
args: ['install']
dir: 'client/web'
waitFor: ['sandbox']
- name: node
id: 'client.web.test'
entrypoint: npm
args: ['test', '--', '--watchAll=false']
dir: 'client/web'
waitFor: ['sandbox', 'client.web.install']
# Deployments
- name: 'gcr.io/cloud-builders/docker'
id: 'server.push.gateway'
args: ['push', 'gcr.io/${PROJECT_ID}/kript-gateway:${SHORT_SHA}']
dir: 'server'
- name: 'gcr.io/cloud-builders/docker'
id: 'server.push.grpc'
args: ['push', 'gcr.io/${PROJECT_ID}/kript-grpc:${SHORT_SHA}']
dir: 'server'
- name: 'gcr.io/cloud-builders/docker'
id: 'server.push.account'
args: ['push', 'gcr.io/${PROJECT_ID}/kript-account:${SHORT_SHA}']
dir: 'server'
- name: 'gcr.io/cloud-builders/docker'
id: 'server.push.data'
args: ['push', 'gcr.io/${PROJECT_ID}/kript-data:${SHORT_SHA}']
dir: 'server'
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
id: 'server.deploy'
entrypoint: 'bash'
args: ['server/scripts/deploy']
env:
- 'BRANCH=$BRANCH_NAME'
- 'PROJECT_ID=$PROJECT_ID'
- 'SHORT_SHA=$SHORT_SHA'
images:
- 'gcr.io/${PROJECT_ID}/kript-gateway:${SHORT_SHA}'
- 'gcr.io/${PROJECT_ID}/kript-grpc:${SHORT_SHA}'
- 'gcr.io/${PROJECT_ID}/kript-account:${SHORT_SHA}'
- 'gcr.io/${PROJECT_ID}/kript-data:${SHORT_SHA}'