forked from cloudfoundry/cf-for-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcf-for-k8s.yml
279 lines (252 loc) · 8.76 KB
/
cf-for-k8s.yml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
---
groups:
- name: cf-for-k8s
jobs:
- validate-cf-for-k8s
- release-validation-pool-manual
- name: Stability Validation
jobs:
- stability-test-cf-for-k8s
- release-stability-pool-manual
resources:
- name: cf-for-k8s-master
type: git
icon: github-box
source:
branch: master
uri: [email protected]:cloudfoundry/cf-for-k8s
private_key: ((cf_for_k8s_readonly_deploy_key.private_key))
ignore_paths:
- ci/**
- name: every-20-minutes
type: time
icon: clock-outline
source:
interval: 20m
# semaphore for the Kubernetes cluster (ci-test-cluster in GKE); it is shared between this pipeline and the CF for K8s PR test pipeline
- name: validation-pool
type: pool
icon: pool
source:
uri: [email protected]:cloudfoundry/relint-ci-pools
branch: master
pool: cf-for-k8s
private_key: ((relint_ci_pools_readwrite_deploy_key.private_key))
- name: stability-pool
type: pool
icon: pool
source:
uri: [email protected]:cloudfoundry/relint-ci-pools
branch: master
pool: cf-for-k8s-stability
private_key: ((relint_ci_pools_readwrite_deploy_key.private_key))
- name: deliver-tracker-stories
type: tracker
source:
token: ((cf_relint_tracker_api_token))
project_id: "1382120"
tracker_url: https://www.pivotaltracker.com
# Extract common platform and image_resource details so task configs can be more concise
x-config: &common-task-config
platform: linux
image_resource:
type: docker-image
source:
repository: relintdockerhubpushbot/cf-for-k8s-ci
# Extract common platform and image_resource details so task configs can be more concise
test-runner-config: &common-test-config
platform: linux
image_resource:
type: docker-image
source:
repository: relintdockerhubpushbot/cf-test-runner
jobs:
- name: validate-cf-for-k8s
serial: true
public: true
plan:
- put: validation-pool
params: {acquire: true}
- get: cf-for-k8s-master
trigger: true
- task: delete-cf
config:
<<: *common-task-config
run:
path: /bin/bash
args:
- -ec
- |
export KUBECONFIG=kube-config.yml
gcloud auth activate-service-account --key-file=<(echo '((ci_k8s_gcp_service_account_json))') --project='((ci_k8s_gcp_project_name))' 1>/dev/null 2>&1
gcloud container clusters get-credentials '((ci_k8s_gke_cluster_name))' --zone '((ci_k8s_gcp_project_zone))' 1>/dev/null 2>&1
kapp delete -a cf --yes
- task: install-cf
config:
<<: *common-task-config
inputs:
- name: cf-for-k8s-master
outputs:
- name: env-metadata
params:
DNS_DOMAIN: ((ci_k8s_domain))
DNS_ZONE_NAME: ((ci_k8s_dns_zone_name))
run:
path: /bin/bash
args:
- -ec
- |
export KUBECONFIG=kube-config.yml
gcloud auth activate-service-account --key-file=<(echo '((ci_k8s_gcp_service_account_json))') --project='((ci_k8s_gcp_project_name))' 1>/dev/null 2>&1
gcloud container clusters get-credentials '((ci_k8s_gke_cluster_name))' --zone '((ci_k8s_gcp_project_zone))' 1>/dev/null 2>&1
cf-for-k8s-master/hack/confirm-network-policy.sh '((ci_k8s_gke_cluster_name))' '((ci_k8s_gcp_project_zone))'
echo "Generating install values..."
cf-for-k8s-master/hack/generate-values.sh "${DNS_DOMAIN}" > cf-install-values.yml
echo "Installing CF..."
cf-for-k8s-master/bin/install-cf.sh cf-install-values.yml
bosh interpolate --path /cf_admin_password cf-install-values.yml > env-metadata/cf-admin-password.txt
echo "${DNS_DOMAIN}" > env-metadata/dns-domain.txt
echo "Configuring DNS..."
cf-for-k8s-master/hack/update-gcp-dns.sh "${DNS_DOMAIN}" "${DNS_ZONE_NAME}"
- task: run-smoke-test
config:
<<: *common-test-config
inputs:
- name: cf-for-k8s-master
- name: env-metadata
run:
path: /bin/sh
args:
- -ec
- |
DNS_DOMAIN=$(cat env-metadata/dns-domain.txt)
export SMOKE_TEST_API_ENDPOINT="https://api.${DNS_DOMAIN}"
export SMOKE_TEST_APPS_DOMAIN="${DNS_DOMAIN}"
export SMOKE_TEST_USERNAME=admin
export SMOKE_TEST_PASSWORD=$(cat env-metadata/cf-admin-password.txt)
cf-for-k8s-master/hack/run-smoke-tests.sh
- task: delete-cf
config:
<<: *common-task-config
run:
path: /bin/bash
args:
- -ec
- |
export KUBECONFIG=kube-config.yml
gcloud auth activate-service-account --key-file=<(echo '((ci_k8s_gcp_service_account_json))') --project='((ci_k8s_gcp_project_name))' 1>/dev/null 2>&1
gcloud container clusters get-credentials '((ci_k8s_gke_cluster_name))' --zone '((ci_k8s_gcp_project_zone))' 1>/dev/null 2>&1
kapp delete -a cf --yes
- put: validation-pool
params: {release: validation-pool}
- put: deliver-tracker-stories
params:
repos:
- cf-for-k8s-master
- name: stability-test-cf-for-k8s
serial: true
public: true
plan:
- put: stability-pool
params: {acquire: true}
- get: cf-for-k8s-master
- get: every-20-minutes
trigger: true
- task: delete-cf
input_mapping: {pool-lock: stability-pool}
config:
<<: *common-task-config
inputs:
- name: pool-lock
run:
path: /bin/bash
args:
- -ec
- |
cluster_name=$(cat pool-lock/name)
export KUBECONFIG=kube-config.yml
gcloud auth activate-service-account --key-file=<(echo '((ci_k8s_gcp_service_account_json))') --project='((ci_k8s_gcp_project_name))' 1>/dev/null 2>&1
gcloud container clusters get-credentials "${cluster_name}" --zone '((ci_k8s_gcp_project_zone))' 1>/dev/null 2>&1
kapp delete -a cf --yes
- task: install-cf
input_mapping: {pool-lock: stability-pool}
config:
<<: *common-task-config
inputs:
- name: cf-for-k8s-master
- name: pool-lock
outputs:
- name: env-metadata
params:
DNS_ZONE_NAME: ((ci_k8s_dns_zone_name))
DNS_ROOT_DOMAIN: ((ci_k8s_root_domain))
run:
path: /bin/bash
args:
- -ec
- |
export KUBECONFIG=kube-config.yml
cluster_name=$(cat pool-lock/name)
gcloud auth activate-service-account --key-file=<(echo '((ci_k8s_gcp_service_account_json))') --project='((ci_k8s_gcp_project_name))' 1>/dev/null 2>&1
gcloud container clusters get-credentials "${cluster_name}" --zone '((ci_k8s_gcp_project_zone))' 1>/dev/null 2>&1
export DNS_DOMAIN="${cluster_name}.${DNS_ROOT_DOMAIN}"
cf-for-k8s-master/hack/confirm-network-policy.sh "${cluster_name}" '((ci_k8s_gcp_project_zone))'
echo "Generating install values..."
cf-for-k8s-master/hack/generate-values.sh "${DNS_DOMAIN}" > cf-install-values.yml
echo "Installing CF..."
cf-for-k8s-master/bin/install-cf.sh cf-install-values.yml
bosh interpolate --path /cf_admin_password cf-install-values.yml > env-metadata/cf-admin-password.txt
echo "${DNS_DOMAIN}" > env-metadata/dns-domain.txt
echo "Configuring DNS..."
cf-for-k8s-master/hack/update-gcp-dns.sh "${DNS_DOMAIN}" "${DNS_ZONE_NAME}"
- task: run-smoke-test
config:
<<: *common-test-config
inputs:
- name: cf-for-k8s-master
- name: env-metadata
run:
path: /bin/sh
args:
- -ec
- |
DNS_DOMAIN=$(cat env-metadata/dns-domain.txt)
export SMOKE_TEST_API_ENDPOINT="https://api.${DNS_DOMAIN}"
export SMOKE_TEST_APPS_DOMAIN="${DNS_DOMAIN}"
export SMOKE_TEST_USERNAME=admin
export SMOKE_TEST_PASSWORD=$(cat env-metadata/cf-admin-password.txt)
cf-for-k8s-master/hack/run-smoke-tests.sh
- task: delete-cf
input_mapping: {pool-lock: stability-pool}
config:
<<: *common-task-config
inputs:
- name: pool-lock
run:
path: /bin/bash
args:
- -ec
- |
cluster_name=$(cat pool-lock/name)
export KUBECONFIG=kube-config.yml
gcloud auth activate-service-account --key-file=<(echo '((ci_k8s_gcp_service_account_json))') --project='((ci_k8s_gcp_project_name))' 1>/dev/null 2>&1
gcloud container clusters get-credentials "${cluster_name}" --zone '((ci_k8s_gcp_project_zone))' 1>/dev/null 2>&1
kapp delete -a cf --yes
- put: stability-pool
params: {release: stability-pool}
- name: release-validation-pool-manual
public: true
plan:
- get: validation-pool
ensure:
try:
put: validation-pool
params: {release: validation-pool}
- name: release-stability-pool-manual
public: true
plan:
- get: stability-pool
ensure:
try:
put: stability-pool
params: {release: stability-pool}