-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-cloud-deploy.yaml
61 lines (61 loc) · 1.67 KB
/
google-cloud-deploy.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
# Instructions to Google Cloud Build to build, test, and deploy
steps:
# Clone the repo **including submodules** into the 'bw' directory
- name: 'gcr.io/cloud-builders/git'
id: Clone
args:
- 'clone'
- '--depth'
- '1'
- '--single-branch'
- '-b'
- '$BRANCH_NAME'
- '--recurse-submodules'
- '--shallow-submodules'
- 'https://github.com/Gapminder/big-waffle.git'
- 'bw'
# Build the container image that will run tests.
- name: 'gcr.io/cloud-builders/docker'
id: BuildTest
args:
- 'build'
- '-f'
- 'bw/test/Dockerfile'
- '-t'
- 'gcr.io/$PROJECT_ID/big-waffle-test:$SHORT_SHA'
- 'bw'
# Run the image, i.e. run the tests
- name: 'gcr.io/cloud-builders/docker'
id: Run
args:
- 'run'
- '--rm'
- 'gcr.io/$PROJECT_ID/big-waffle-test:$SHORT_SHA'
# Build the container image will be deployed to the service cluster.
- name: 'gcr.io/cloud-builders/docker'
id: Build
args:
- 'build'
- '-t'
- 'eu.gcr.io/$PROJECT_ID/big-waffle-server:$SHORT_SHA'
- '.'
# Push the image to the registry
- name: 'gcr.io/cloud-builders/docker'
id: Push
args:
- 'push'
- 'eu.gcr.io/$PROJECT_ID/big-waffle-server:$SHORT_SHA'
# Roll out the new image to the pods in the cluster
- name: 'gcr.io/cloud-builders/kubectl'
id: RollOut
args:
- 'set'
- 'image'
- 'deployment/bigwaffle-service'
- '*=eu.gcr.io/$PROJECT_ID/big-waffle-server:$SHORT_SHA'
env:
- 'CLOUDSDK_COMPUTE_ZONE=europe-north1-a'
- 'CLOUDSDK_CONTAINER_CLUSTER=service-cluster-bigwaffle'
# Updating the BigWaffle Master is usually not urgent.
# It can be accompished by a Cloud Function that subscribes
# to the 'cloud-builds' topic (see https://cloud.google.com/cloud-build/docs/send-build-notifications).