forked from JeremyRms/hello-world-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
59 lines (52 loc) · 1.81 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
steps:
- id: decipher secret
name: gcr.io/cloud-builders/gcloud
args:
- kms
- decrypt
- "--ciphertext-file=secret.yaml.encrypted"
- "--plaintext-file=secret.yaml"
- "--location=$_GKE_LOCATION"
- "--keyring=maetad-key-ring"
- "--key=hello-world-k8s"
- id: Generate application secret
name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', 'secret.yaml', '--namespace', '$_K8S_NAMESPACE']
env:
- 'CLOUDSDK_COMPUTE_ZONE=$_GKE_LOCATION'
- 'CLOUDSDK_CONTAINER_CLUSTER=$_GKE_CLUSTER'
# - id: Generate application configMap
# name: 'gcr.io/cloud-builders/kubectl'
# args: ['apply', '-f', 'configmap.yaml', '--namespace', '$_K8S_NAMESPACE']
# env:
# - 'CLOUDSDK_COMPUTE_ZONE=$_GKE_LOCATION'
# - 'CLOUDSDK_CONTAINER_CLUSTER=$_GKE_CLUSTER'
- id: Build
name: gcr.io/cloud-builders/docker
entrypoint: bash
args: ["-c", "docker build -t asia.gcr.io/effective-might-323902/hello-world-k8s-maetad . -f Dockerfile"]
- id: Push
name: gcr.io/cloud-builders/docker
args: ["push", "asia.gcr.io/effective-might-323902/hello-world-k8s-maetad"]
- id: Generate manifest
name: gcr.io/cloud-builders/gke-deploy
entrypoint: kustomize
args:
- build
- kubernetes/overlays/$_KUSTOMIZE_ENV
- -o
- /workspace/kustomize-output.yaml
env:
- 'CLOUDSDK_COMPUTE_ZONE=$_GKE_LOCATION'
- 'CLOUDSDK_CONTAINER_CLUSTER=$_GKE_CLUSTER'
- id: Apply deploy
name: gcr.io/cloud-builders/gke-deploy
args: ["apply", "--filename=kustomize-output.yaml", "--cluster=maetad-cluster", "--location=asia-southeast1", "--namespace=maetad"]
env:
- 'CLOUDSDK_COMPUTE_ZONE=$_GKE_LOCATION'
- 'CLOUDSDK_CONTAINER_CLUSTER=$_GKE_CLUSTER'
options:
substitutionOption: ALLOW_LOOSE
tags:
- devops-workshop
- hello-world-k8s