-
Notifications
You must be signed in to change notification settings - Fork 176
/
cloudbuild-production.yaml
99 lines (88 loc) · 3.25 KB
/
cloudbuild-production.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
steps:
- name: 'gcr.io/cloud-builders/docker'
id: pull-app-image-cache
args: ['pull', 'gcr.io/$PROJECT_ID/learningequality-studio-app:latest']
- name: 'gcr.io/cloud-builders/docker'
id: build-app-image
entrypoint: bash
waitFor: ['pull-app-image-cache'] # wait for app image cache pull to finish
args:
- -c
- >
docker build
--build_arg COMMIT_SHA=$COMMIT_SHA
-f k8s/images/app/Dockerfile
--cache-from gcr.io/$PROJECT_ID/learningequality-studio-app:latest
-t gcr.io/$PROJECT_ID/learningequality-studio-app:$COMMIT_SHA
-t gcr.io/$PROJECT_ID/learningequality-studio-app:latest
.
- name: 'gcr.io/cloud-builders/docker'
id: build-nginx-image
waitFor: ['-'] # don't wait for previous steps
args: [
'build',
'-f', 'k8s/images/nginx/Dockerfile',
'--cache-from', 'gcr.io/$PROJECT_ID/learningequality-studio-nginx:latest',
'-t', 'gcr.io/$PROJECT_ID/learningequality-studio-nginx:$COMMIT_SHA',
'-t', 'gcr.io/$PROJECT_ID/learningequality-studio-nginx:latest',
'.'
]
- name: 'gcr.io/cloud-builders/docker'
id: pull-prober-image-cache
waitFor: ['-']
args: ['pull', 'gcr.io/$PROJECT_ID/learningequality-studio-prober:latest']
- name: 'gcr.io/cloud-builders/docker'
id: build-prober-image
waitFor: ['pull-prober-image-cache'] # don't wait for previous steps
args: [
'build',
'-f', 'k8s/images/prober/Dockerfile',
'--cache-from', 'gcr.io/$PROJECT_ID/learningequality-studio-prober:latest',
'-t', 'gcr.io/$PROJECT_ID/learningequality-studio-prober:$COMMIT_SHA',
'-t', 'gcr.io/$PROJECT_ID/learningequality-studio-prober:latest',
'.'
]
- name: 'gcr.io/cloud-builders/docker'
id: push-app-image
waitFor: ['build-app-image']
args: ['push', 'gcr.io/$PROJECT_ID/learningequality-studio-app:$COMMIT_SHA']
- name: 'gcr.io/cloud-builders/docker'
id: push-nginx-image
waitFor: ['build-nginx-image']
args: ['push', 'gcr.io/$PROJECT_ID/learningequality-studio-nginx:$COMMIT_SHA']
- name: 'gcr.io/cloud-builders/docker'
id: push-prober-image
waitFor: ['build-prober-image']
args: ['push', 'gcr.io/$PROJECT_ID/learningequality-studio-prober:$COMMIT_SHA']
- name: 'gcr.io/$PROJECT_ID/helm'
id: helm-deploy-studio-instance
waitFor: ['push-app-image', 'push-nginx-image']
dir: "k8s"
env:
- 'CLOUDSDK_COMPUTE_ZONE=us-central1-f'
- 'CLOUDSDK_CONTAINER_CLUSTER=contentworkshop-central'
entrypoint: 'bash'
args:
- -c
- >
/builder/helm.bash &&
./helm-deploy.sh
$BRANCH_NAME
gcr.io/$PROJECT_ID/learningequality-studio-app:$COMMIT_SHA
gcr.io/$PROJECT_ID/learningequality-studio-nginx:$COMMIT_SHA
$_STORAGE_BUCKET
$COMMIT_SHA
$PROJECT_ID
$_DATABASE_INSTANCE_NAME
us-central1
substitutions:
_DATABASE_INSTANCE_NAME: develop # by default, connect to the develop DB
_STORAGE_BUCKET: develop-studio-content
timeout: 3600s
images:
- gcr.io/$PROJECT_ID/learningequality-studio-nginx:latest
- gcr.io/$PROJECT_ID/learningequality-studio-nginx:$COMMIT_SHA
- gcr.io/$PROJECT_ID/learningequality-studio-app:latest
- gcr.io/$PROJECT_ID/learningequality-studio-app:$COMMIT_SHA
- 'gcr.io/$PROJECT_ID/learningequality-studio-prober:$COMMIT_SHA'
- 'gcr.io/$PROJECT_ID/learningequality-studio-prober:latest'