forked from crosscloudci/cross-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
469 lines (420 loc) · 13.1 KB
/
.gitlab-ci.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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
variables:
K8S_BRANCH: ci-master
COREDNS_BRANCH: ci-master
PROMETHEUS_BRANCH: ci-master
NODE_EXPORTER_BRANCH: ci-master
ALERT_MANAGER_BRANCH: ci-master
CNI_BRANCH: ci-master
FLUENTD_BRANCH: ci-master
CONTAINERD_BRANCH: ci-master
stages:
- cncf-artifacts
- cross-cloud
- cross-project
- cncf-e2e
before_script:
- export BASE_URL=${BASE_URL:-$(echo $CI_PROJECT_URL | cut -d'/' -f1-3)}
- export KUBECONFIG=$(pwd)/data/${CI_ENVIRONMENT_SLUG}/kubeconfig
- mkdir -p ./data ; touch ./data/empty.env
- for envfile in data/*env ; do source $envfile ; echo ----- $envfile ---- ; cat $envfile ; done
kubernetes-master:
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cncf-artifacts
script:
- KUBERNETES_RELEASE_ENV=$(curl -s -L
"$BASE_URL/kubernetes/kubernetes/builds/artifacts/${K8S_BRANCH}/file/release.env?job=build"
| sed -n 's/.*href="\([^"]*\).*/\1/p' | grep artifacts/raw | tail -1)
- mkdir -p data
- curl -s -o data/kubernetes.env -L ${BASE_URL}/$KUBERNETES_RELEASE_ENV
- cat data/kubernetes.env
artifacts:
when: always
expire_in: 4 weeks
paths:
- ./data/
.fluentd-master:
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cncf-artifacts
script:
- RELEASE_ENV_URL="$BASE_URL/fluent/fluentd/builds/artifacts/${FLUENTD_BRANCH}/file/release.env?job=release"
- echo $RELEASE_ENV_URL
- CNI_RELEASE_ENV=$(curl -s -L
$RELEASE_ENV_URL
| sed -n 's/.*href="\([^"]*\).*/\1/p' | grep artifacts/raw | tail -1)
- curl -s -o data/cni.env -L ${BASE_URL}/$CNI_RELEASE_ENV
- cat data/cni.env
artifacts:
when: always
expire_in: 4 weeks
paths:
- ./data/
coredns-master:
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cncf-artifacts
script:
- COREDNS_RELEASE_ENV=$(curl -s -L
"$BASE_URL/coredns/coredns/builds/artifacts/${COREDNS_BRANCH}/file/release.env?job=release"
| sed -n 's/.*href="\([^"]*\).*/\1/p' | grep artifacts/raw | tail -1)
- mkdir -p data
- curl -s -o data/coredns.env -L ${BASE_URL}/$COREDNS_RELEASE_ENV
- cat data/coredns.env
artifacts:
when: always
expire_in: 4 weeks
paths:
- ./data/
prometheus-master:
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cncf-artifacts
script:
- mkdir -p data
- PROMETHEUS_URL="$BASE_URL/prometheus/prometheus/builds/artifacts/${PROMETHEUS_BRANCH}/file/release.env?job=release"
- PROMETHEUS_RELEASE_ENV=$(curl -s -L $PROMETHEUS_URL | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep artifacts/raw | tail -1)
- curl -s -o data/prom.env -L ${BASE_URL}/$PROMETHEUS_RELEASE_ENV
- NODE_EXPORTER_URL="$BASE_URL/prometheus/node_exporter/builds/artifacts/${NODE_EXPORTER_BRANCH}/file/release.env?job=release"
- NODE_EXPORTER_RELEASE_ENV=$(curl -s -L $NODE_EXPORTER_URL | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep artifacts/raw | tail -1)
- curl -s -o data/node_exporter.env -L ${BASE_URL}/$NODE_EXPORTER_RELEASE_ENV
- ALERT_MANAGER_URL="$BASE_URL/prometheus/alertmanager/builds/artifacts/${ALERT_MANAGER_BRANCH}/file/release.env?job=release"
- ALERT_MANAGER_RELEASE_ENV=$(curl -s -L $ALERT_MANAGER_URL | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep artifacts/raw | tail -1)
- curl -s -o data/alert_manager.env -L ${BASE_URL}/$ALERT_MANAGER_RELEASE_ENV
- cat data/prom.env data/node_exporter.env data/alert_manager.env
artifacts:
when: always
expire_in: 4 weeks
paths:
- ./data/
cross-cloud-master:
stage: cncf-artifacts
script:
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker build --pull -t "$CI_REGISTRY_IMAGE/provisioning:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE/provisioning:$CI_COMMIT_REF_SLUG"
.k8s_deploy_template: &k8s_deploy_template
allow_failure: true
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cross-cloud
variables:
CLOUD: MUST BE SET
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.cncf.ci/
on_stop: MUST BE SET
script:
- /cncf/provision.sh ${CLOUD}-deploy ${CI_ENVIRONMENT_SLUG}
- helm init ; sleep 60
# - helm init ; until [ ! -e $(
# kubectl get pods --namespace=kube-system -l app=helm -l name=tiller
# -o jsonpath='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
# | grep "Ready=True") ] ;
# do echo 'tiller not up yet' ;
# sleep 2 ;
# done
artifacts:
when: always
expire_in: 4 weeks
paths:
- ./data/
.k8s_e2e_template: &k8s_e2e_template
image: ${CI_REGISTRY}/kubernetes/kubernetes/kubernetes-e2e:ci-v1-6-3.job.4793
stage: cncf-e2e
# dependencies:
# - k8s_deploy_aws
variables:
CLOUD: MUST BE SET
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.demo.cncf.ci/
script:
- /kubernetes/e2e/run-conformance.sh
.k8s_cloud_destroy_template: &k8s_cloud_destroy_template
allow_failure: true
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cross-cloud
when: manual
variables:
CLOUD: MUST BE SET
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.demo.cncf.ci/
action: stop
script:
- /cncf/provision.sh ${CLOUD}-destroy ${CI_ENVIRONMENT_SLUG}
.coredns_deploy_template: &coredns_deploy_template
allow_failure: true
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cross-project
# when: manual
variables:
CLOUD: MUST BE SET
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.demo.cncf.ci/
script:
- cat ./data/coredns.env
- env | grep COREDNS
- kubectl get nodes
- kubectl get componentstatuses
- helm init
- echo Removing any previous deploys of coredns
- helm get coredns > /dev/null && helm delete --purge coredns
- kubectl get svc --namespace=kube-system -l name=coredns
- kubectl get pods --namespace=kube-system -l name=kube-dns
- helm repo add cncf http://cncf.gitlab.io/stable
- COREDNS_INSTALL="helm install --name coredns
--namespace=kube-system
--set middleware.kubernetes.clusterCidr=10.0.0.0/24
--set middleware.kubernetes.clusterIP=10.0.0.10
--set middleware.prometheus.enabled=false
--set middleware.errors.enabled=true
--set middleware.log.enabled=true
--set middleware.loadbalance.enabled=false
--set middleware.test.enabled=false
--set image.repository=${COREDNS_IMAGE}
--set image.tag=${COREDNS_TAG}
cncf/coredns"
- echo $COREDNS_INSTALL ; $COREDNS_INSTALL
- DEPLOYED_COREDNS_IMAGE=$(kubectl get pods --namespace=kube-system -l k8s-app=coredns -o jsonpath="{.items[0].spec.containers[0].image}")
- echo Deployed CoreDNS Image - $DEPLOYED_COREDNS_IMAGE
- kubectl get svc --namespace=kube-system -l k8s-app=coredns
- kubectl get pods --namespace=kube-system -l k8s-app=coredns
.coredns_e2e_template: &coredns_e2e_template
image: ${CI_REGISTRY}/coredns/coredns/coredns-e2e:ci-v007.job.4744
stage: cncf-e2e
# dependencies:
# - coredns_deploy_aws
variables:
CLOUD: MUST BE SET
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.demo.cncf.ci/
script:
- kubectl proxy --port 8080 &
- kubectl create -f /coredns/e2e/test.yml || kubectl replace -f /coredns/e2e/test.yml
- cd /go/src/github.com/coredns/coredns/test
- go test -v -tags k8s
.prometheus_deploy_template: &prometheus_deploy_template
allow_failure: true
image: ${CI_REGISTRY}/cncf/cross-cloud/provisioning:$CI_COMMIT_REF_SLUG
stage: cross-project
# when: manual
variables:
CLOUD: must be set
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.demo.cncf.ci/
script:
- find ./data/
- ls -la $(pwd)/data/${CI_ENVIRONMENT_SLUG}/
- kubectl get nodes
- kubectl get pods
- kubectl get componentstatuses
- helm init
- echo Removing any previous deploys of prometheus
- helm get prometheus > /dev/null && helm delete --purge prometheus
- PROMETHEUS_INSTALL="helm install --name prometheus
--set server.image.repository=$PROMETHEUS_IMAGE
--set server.image.tag=$PROMETHEUS_TAG
--set server.persistentVolume.enabled=false
--set nodeExporter.image.repository=$NODE_EXPORTER_IMAGE
--set nodeExporter.image.tag=$NODE_EXPORTER_TAG
--set alertManager.image.repository=$ALERT_MANAGER_IMAGE
--set alertManager.image.tag=$ALERT_MANAGER_TAG
--set alertManager.persistentVolume.enabled=false
stable/prometheus"
- echo $PROMETHEUS_INSTALL ; $PROMETHEUS_INSTALL
- DEPLOYED_PROMETHEUS_IMAGE="$(kubectl describe pods -l app=prometheus,component=server | grep cncf.ci| grep prometheus | awk '{print $2}')"
- echo Deployed Prometheus Image - $DEPLOYED_PROMETHEUS_IMAGE
- kubectl get svc
- kubectl get pods
.prometheus_e2e_template: &prometheus_e2e_template
image: ${CI_REGISTRY}/coredns/coredns/coredns-e2e:ci-v007.job.4744
stage: cncf-e2e
# dependencies:
# - prometheus_deploy_aws
variables:
CLOUD: MUST BE SET
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.demo.cncf.ci/
script:
- echo FIXME && exit 1
aws_k8s_deploy:
<<: *k8s_deploy_template
variables:
CLOUD: aws
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.cncf.ci/
on_stop: aws_k8s_destroy
aws_k8s_e2e:
<<: *k8s_e2e_template
variables:
CLOUD: aws
aws_k8s_destroy:
<<: *k8s_cloud_destroy_template
variables:
CLOUD: aws
aws_coredns_deploy:
<<: *coredns_deploy_template
variables:
CLOUD: aws
dependencies:
- aws_k8s_deploy
aws_coredns_e2e:
<<: *coredns_e2e_template
variables:
CLOUD: aws
aws_prom_deploy:
<<: *prometheus_deploy_template
variables:
CLOUD: aws
dependencies:
- aws_k8s_deploy
aws_prom_e2e:
<<: *prometheus_e2e_template
variables:
CLOUD: aws
packet_k8s_deploy:
<<: *k8s_deploy_template
variables:
CLOUD: packet
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.cncf.ci/
on_stop: packet_k8s_destroy
packet_k8s_e2e:
<<: *k8s_e2e_template
variables:
CLOUD: packet
packet_k8s_destroy:
<<: *k8s_cloud_destroy_template
variables:
CLOUD: packet
packet_coredns_deploy:
<<: *coredns_deploy_template
variables:
CLOUD: packet
dependencies:
- packet_k8s_deploy
packet_coredns_e2e:
<<: *coredns_e2e_template
variables:
CLOUD: packet
packet_prom_deploy:
<<: *prometheus_deploy_template
variables:
CLOUD: packet
dependencies:
- packet_k8s_deploy
packet_prom_e2e:
<<: *prometheus_e2e_template
variables:
CLOUD: packet
gce_k8s_deploy:
<<: *k8s_deploy_template
variables:
CLOUD: gce
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.cncf.ci/
on_stop: gce_k8s_destroy
gce_k8s_e2e:
<<: *k8s_e2e_template
variables:
CLOUD: gce
gce_k8s_destroy:
<<: *k8s_cloud_destroy_template
variables:
CLOUD: gce
gce_coredns_deploy:
<<: *coredns_deploy_template
variables:
CLOUD: gce
dependencies:
- gce_k8s_deploy
gce_coredns_e2e:
<<: *coredns_e2e_template
variables:
CLOUD: gce
gce_prom_deploy:
<<: *prometheus_deploy_template
variables:
CLOUD: gce
dependencies:
- gce_k8s_deploy
gce_prom_e2e:
<<: *prometheus_e2e_template
variables:
CLOUD: gce
gke_k8s_deploy:
<<: *k8s_deploy_template
variables:
CLOUD: gke
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.cncf.ci/
on_stop: gke_k8s_destroy
gke_k8s_e2e:
<<: *k8s_e2e_template
variables:
CLOUD: gke
gke_k8s_destroy:
<<: *k8s_cloud_destroy_template
variables:
CLOUD: gke
gke_coredns_deploy:
<<: *coredns_deploy_template
variables:
CLOUD: gke
dependencies:
- gke_k8s_deploy
gke_coredns_e2e:
<<: *coredns_e2e_template
variables:
CLOUD: gke
gke_prom_deploy:
<<: *prometheus_deploy_template
variables:
CLOUD: gke
dependencies:
- gke_k8s_deploy
gke_prom_e2e:
<<: *prometheus_e2e_template
variables:
CLOUD: gke
.azure_k8s_deploy:
<<: *k8s_deploy_template
variables:
CLOUD: azure
environment:
name: ${CLOUD}-${CI_COMMIT_REF_SLUG}
url: https://$CI_ENVIRONMENT_SLUG.cncf.ci/
on_stop: azure_k8s_destroy
.azure_k8s_e2e:
<<: *k8s_e2e_template
variables:
CLOUD: azure
.azure_k8s_destroy:
<<: *k8s_cloud_destroy_template
variables:
CLOUD: azure
.azure_coredns_deploy:
<<: *coredns_deploy_template
variables:
CLOUD: azure
dependencies:
- azure_k8s_deploy
.azure_coredns_e2e:
<<: *coredns_e2e_template
variables:
CLOUD: azure
.azure_prom_deploy:
<<: *prometheus_deploy_template
variables:
CLOUD: azure
dependencies:
- azure_k8s_deploy
.azure_prom_e2e:
<<: *prometheus_e2e_template
variables:
CLOUD: azure