forked from kelseyhightower/pipeline-infrastructure-staging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
42 lines (39 loc) · 1.09 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
#
# User-defined substitutions:
# _CLOUDSDK_COMPUTE_ZONE
# _CLOUDSDK_CONTAINER_CLUSTER
#
steps:
# Generate a kubeconfig file for the given GKE cluster.
- name: 'gcr.io/cloud-builders/gcloud'
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_CLOUDSDK_COMPUTE_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
- 'KUBECONFIG=/kube/config'
entrypoint: 'sh'
args:
- '-c'
- |
CLUSTER=$$(gcloud config get-value container/cluster)
PROJECT=$$(gcloud config get-value core/project)
ZONE=$$(gcloud config get-value compute/zone)
gcloud container clusters get-credentials "$${CLUSTER}" \
--project "$${PROJECT}" \
--zone "$${ZONE}"
volumes:
- name: 'kube'
path: /kube
# Recursively apply the configuration files under the kubernetes
# directory.
- name: 'gcr.io/cloud-builders/gcloud'
env:
- 'KUBECONFIG=/kube/config'
entrypoint: 'sh'
args:
- '-c'
- |
kubectl apply --recursive -f kubernetes
volumes:
- name: 'kube'
path: /kube
timeout: 300s