-
Notifications
You must be signed in to change notification settings - Fork 14
/
cloudbuild.dev.yaml
72 lines (68 loc) · 1.92 KB
/
cloudbuild.dev.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
# See list of built-in substitutions at
# https://cloud.google.com/container-builder/docs/configuring-builds/substitute-variable-values
substitutions:
_CLOUDSDK_COMPUTE_REGION: us-central1
_CLOUDSDK_CONTAINER_CLUSTER: dev-gke
_ENVIRONMENT: dev
_GCLOUD_PROJECT: etcd-io-dev
_HELM_CHART_GIT_REPO: https://github.com/etcd-io/discovery.etcd.io.git
_HELM_CHART_GIT_BRANCH: master
_HELM_CHART_PATH: kubernetes/helm
_K8S_NAMESPACE: discoveryserver
_REPO_NAME: discoveryserver
steps:
- name: 'gcr.io/cloud-builders/docker' # Build and tag discoveryserver image
args:
- build
- -t
- gcr.io/$PROJECT_ID/${_REPO_NAME}:$COMMIT_SHA
- -t
- gcr.io/$PROJECT_ID/${_REPO_NAME}:latest
- --cache-from
- gcr.io/$PROJECT_ID/${_REPO_NAME}:latest
- .
- name: 'gcr.io/cloud-builders/docker' # Push discoveryserver image to gcr
args: ['push', 'gcr.io/$PROJECT_ID/${_REPO_NAME}:$COMMIT_SHA']
- name: 'gcr.io/cloud-builders/git' # Clone infrastructure repo
args: ['clone', '${_HELM_CHART_GIT_REPO}', '/helm']
volumes:
- name: 'helm'
path: '/helm'
- name: 'gcr.io/cloud-builders/git'
args: ['checkout', '${_HELM_CHART_GIT_BRANCH}']
dir: '/helm'
volumes:
- name: 'helm'
path: '/helm'
- name: 'gcr.io/cloudkite-public/gcloud-helm3:20191117' # Deploy helm chart
args:
- /usr/local/bin/helm
- upgrade
- --atomic
- --wait
- --timeout
- "900s"
- --install
- --namespace
- ${_K8S_NAMESPACE}
- --values
- ${_HELM_CHART_PATH}/${_REPO_NAME}/${_ENVIRONMENT}.values.yaml
- --debug
- --set
- image.tag=${COMMIT_SHA}
- ${_REPO_NAME}
- ${_HELM_CHART_PATH}/${_REPO_NAME}
dir: '/helm'
env:
- 'GCLOUD_PROJECT=${_GCLOUD_PROJECT}'
- 'CLOUDSDK_COMPUTE_REGION=${_CLOUDSDK_COMPUTE_REGION}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
volumes:
- name: 'helm'
path: '/helm'
images:
- 'gcr.io/$PROJECT_ID/${_REPO_NAME}:latest'
timeout: 900s
tags:
- ${_REPO_NAME}
- ${_ENVIRONMENT}