-
Notifications
You must be signed in to change notification settings - Fork 579
/
Copy pathbuild-push-gke-deploy.yaml
145 lines (144 loc) · 4.19 KB
/
build-push-gke-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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-and-push
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: deploy
spec:
description: >-
This Pipeline builds, pushes, and deploys your application to a Google Kubernetes
Engine cluster using gke-deploy.
params:
- name: pathToContext
description: The path to the build context relative to your source repo's root. This is used by Kaniko.
default: .
- name: pathToDockerFile
description: The path to the dockerfile to build, relative to the context.
default: Dockerfile
- name: imageUrl
description: URL of image repository.
- name: imageTag
description: Tag to apply to the built image.
default: latest
workspaces:
- name: source
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor
command:
- /kaniko/executor
args:
- --dockerfile=$(params.pathToDockerFile)
- --destination=$(params.imageUrl):$(params.imageTag)
- --context=$(workspaces.source.path)/$(params.pathToContext)
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: deploy-using-gke-deploy
spec:
params:
- name: pathToKubernetesConfigs
description: The path to the Kubernetes configs to deploy, relative to your source repo's root.
- name: imageUrl
description: URL of image repository
- name: imageTag
description: Tag of the images to be used.
default: latest
- name: clusterName
description: Name of target GKE cluster to deploy to.
- name: clusterLocation
description: Zone/region of target GKE cluster to deploy to.
- name: clusterProject
description: Project of target GKE cluster to deploy to.
default: ""
workspaces:
- name: source
steps:
- name: deploy-using-gke-deploy
image: gcr.io/cloud-builders/gke-deploy
workingDir: $(workspaces.source.path)
command: ["/gke-deploy"]
args:
- "run"
- "--image=$(params.imageUrl):$(params.imageTag)"
- "--filename=$(workspaces.source.path)/$(params.pathToKubernetesConfigs)"
- "--cluster=$(params.clusterName)"
- "--location=$(params.clusterLocation)"
- "--project=$(params.clusterProject)"
- "--output=/var/tmp/gke-deploy"
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: build-push-gke-deploy
spec:
workspaces:
- name: source
params:
- name: pathToContext
type: string
description: The path to the build context relative to your source repo's root. This is used by Kaniko.
default: .
- name: pathToDockerFile
type: string
description: The path to the dockerfile to build, relative to the context.
default: Dockerfile
- name: pathToKubernetesConfigs
type: string
description: The path to the Kubernetes configs to deploy, relative to your source repo's root.
- name: imageUrl
type: string
description: URL of image repository.
- name: imageTag
type: string
description: Tag to apply to the built image.
default: latest
- name: clusterName
type: string
description: Name of target GKE cluster to deploy to.
- name: clusterLocation
type: string
description: Zone/region of target GKE cluster to deploy to.
- name: clusterProject
type: string
description: Project of target GKE cluster to deploy to.
default: ""
tasks:
- name: build-and-push
taskRef:
name: build-and-push
params:
- name: pathToContext
value: "$(params.pathToContext)"
- name: imageUrl
value: "$(params.imageUrl)"
- name: imageTag
value: "$(params.imageTag)"
workspaces:
- name: source
workspace: source
- name: deploy-using-gke-deploy
taskRef:
name: deploy-using-gke-deploy
runAfter:
- build-and-push
params:
- name: pathToKubernetesConfigs
value: "$(params.pathToKubernetesConfigs)"
- name: imageUrl
value: "$(params.imageUrl)"
- name: imageTag
value: "$(params.imageTag)"
- name: clusterName
value: "$(params.clusterName)"
- name: clusterLocation
value: "$(params.clusterLocation)"
- name: clusterProject
value: "$(params.clusterProject)"
workspaces:
- name: source
workspace: source