forked from keptn/keptn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
653 lines (616 loc) · 29.3 KB
/
.travis.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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
sudo: true
language: go
go:
- 1.13.x
cache:
directories:
- "$HOME/google-cloud-sdk/"
env:
global:
- GO111MODULE=on
- GOPROXY=https://proxy.golang.org
# configure notifications for failed builds
notifications:
slack:
rooms:
# token generated using travis encrypt "..." --add notifications.slack -r keptn/keptn --org
- secure: NjL/yh3BkTig19hV7nH0q+XxNOxCGTuhdn69WV8tsR0TXp8gqQxD8pnyPX7/nNdkc9PPAUCLGdFlU+vsa3SFt1cdZCgi44lvqHPHBZCa1Sh2+CxqCPRe9NQzU8JJBwDO9OEezbL7Pbfoi7m56MVU6JfkX5RPwN7RLcyCUane/STu3NDBeJLvn0qhjXMFlfKibdwdWom+TZxMiWaZ3oX1omtE88fiHaEGDjTobO3GNR6er9Rd0peAf7LXyHPrJDC0Ss8bz6OVNPQQFtFVwHG/0zVGwZPDbDUw2U+C8DsBVofhPRKhK2g2o0VAESKgrREdDPyVtAsbOnxGnudyPv94whhNjv3aVLeNilNiujXBgeC5R8aWNc2FthDUdB1clKDRFpwiXi0F1J+3bYN498p7QI+Yrr9XSJA62ZCeUjm3Sg2zFs7VtILgCTSbPKzAL4XjSnzefAS8MnG137TnYbwyi9Z/5+XgmLwSguLRMnMlktOH4JxUvD4ImVO7OI/QYYLtUjqqSyjywEa4v+MsyuuqaiT2m4GFpIRKxB4C3c/kONn2kUAd9LM1eIcHonPNmvH36k41nTf+XLOOICy2i1+m1aB18q5yj8qeaQZenpf2WheflM9zDgZc3cku6ZnyZCMdlhLnKfMiCgf8sYvL8qnq1XY2yikeZt4SuMCKLl5wdlI=
if: (branch = master or branch =~ ^release.*$) AND (type = cron OR type = push)
on_success: never
on_failure: always
before_install:
# determine OS type (either osx for linux) - will be used for downloading dependencies
- |
OS_TYPE="linux"
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
OS_TYPE="darwin"
fi
export OS_TYPE
# Build variables
- export TZ=Europe/Vienna
- VERSION="unknownversion"
- DATE="$(date +'%Y%m%d.%H%M')"
- GIT_SHA="$(git rev-parse --short HEAD)"
- KUBE_CONSTRAINTS=">= 1.14, <= 1.18" # don't forget to udpate the defaults in cli/main.go
# store all changed files from this commit in files.txt (careful - travis commit range might fail)
- git diff --name-only $TRAVIS_COMMIT_RANGE > files.txt || echo ""
# for non pull requests, use another type of commit range in addition
- |
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin master
git diff --name-only origin/master...$TRAVIS_BRANCH >> files.txt
fi
- cat files.txt
- CHANGED_FILES=$(tr '\n' , < files.txt)
# get current git branch name
- GIT_BRANCH_NAME=$(git branch | grep \* | cut -d ' ' -f2)
- BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, BRANCH=$BRANCH"
# configure folders and image names
- CLI_FOLDER="cli/"
- API_IMAGE="keptn/api"
- API_FOLDER="api/"
- OS_ROUTE_SVC_IMAGE="keptn/openshift-route-service"
- OS_ROUTE_SVC_FOLDER="platform-support/openshift-route-service/"
- BRIDGE_IMAGE="keptn/bridge2"
- BRIDGE_FOLDER="bridge/"
- JMETER_SVC_IMAGE="keptn/jmeter-service"
- JMETER_SVC_FOLDER="jmeter-service/"
- HELM_SVC_IMAGE="keptn/helm-service"
- HELM_SVC_FOLDER="helm-service/"
- GATEKEEPER_SVC_IMAGE="keptn/gatekeeper-service"
- GATEKEEPER_SVC_FOLDER="gatekeeper-service/"
- DISTRIBUTOR_IMAGE="keptn/distributor"
- DISTRIBUTOR_FOLDER="distributor/"
- EVENTBROKER_IMAGE="keptn/eventbroker-go"
- EVENTBROKER_FOLDER="eventbroker/"
- SHIPYARD_SVC_IMAGE="keptn/shipyard-service"
- SHIPYARD_SVC_FOLDER="shipyard-service/"
- CONFIGURATION_SVC_IMAGE="keptn/configuration-service"
- CONFIGURATION_SVC_FOLDER="configuration-service/"
- REMEDIATION_SVC_IMAGE="keptn/remediation-service"
- REMEDIATION_SVC_FOLDER="remediation-service/"
- WAIT_SVC_IMAGE="keptn/wait-service"
- WAIT_SVC_FOLDER="wait-service/"
- LIGHTHOUSE_SVC_IMAGE="keptn/lighthouse-service"
- LIGHTHOUSE_SVC_FOLDER="lighthouse-service/"
- MONGODB_DS_IMAGE="keptn/mongodb-datastore"
- MONGODB_DS_FOLDER="mongodb-datastore/"
- INSTALLER_IMAGE="keptn/installer"
- INSTALLER_FOLDER="installer/"
- export KEPTN_INSTALLER_IMAGE=keptn/installer:latest
- export KEPTN_CLI_VERSION=latest
- | # set installer image and cli version for release-branches
if [[ $BRANCH =~ ^release.* ]]; then
export KEPTN_INSTALLER_IMAGE=keptn/installer:${BRANCH#"release-"}
export KEPTN_CLI_VERSION=${BRANCH#"release-"}
fi
# generate a lower-case slug of the branch name
- BRANCH_SLUG=$(echo ${BRANCH} | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z)
### ATTENTION: please make sure installer is always the last in this list
# template for gke tests
gke_full: &gke_full
os: linux
before_script:
# set CLUSTER_NAME_NIGHTLY according to current branch and GKE_VERSION
- export CLUSTER_NAME_NIGHTLY=${CLUSTER_NAME_NIGHTLY}-${BRANCH_SLUG:0:15}-gke${GKE_VERSION//./}
- source ./travis-scripts/install_gcloud.sh
# auth gcloud
- echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ~/gcloud-service-key.json
- gcloud auth activate-service-account --key-file ~/gcloud-service-key.json
- test/utils/download_and_install_keptn_cli.sh
# create gke cluster on gcloud
- test/utils/gke_create_cluster.sh
script:
# test installation on gcloud
- test/test_install_gke.sh
- test/utils/expose_keptn_bridge.sh
# test onboarding and new-artifact for sockshop
- export PROJECT=sockshop
- test/test_onboard_service.sh
- test/test_new_artifact.sh
- test/test_delete_project.sh
- test/test_self_healing.sh
- test/test_delivery_assistant.sh
- test/test_keptn_uninstall.sh
after_success:
# delete google kubernetes cluster only on success (in case of an error we want to be able to dig into the cluster)
- echo "Tests were successful, cleaning up the cluster now..."
- test/utils/gke_delete_cluster.sh
after_failure:
# print some debug info
- echo "Keptn Installation Log:"
- cat ~/.keptn/keptn-installer.log
- kubectl get events --sort-by='.lastTimestamp' --all-namespaces
- kubectl get pods --all-namespaces
- kubectl get services --all-namespaces
- kubectl get ingress --all-namespaces
jobs:
include:
##################################################################################
# Jobs that are always executed
##################################################################################
- stage: Unit tests # Bridge
os: linux
addons:
chrome: stable
language:
node_js
node_js:
- 10
install:
- npm install -g codecov # install codecov globally
- npm install -g [email protected] # install npx globally
script:
- cd bridge
- npm install
- npm run test:ci
after_success:
- bash <(curl -s https://codecov.io/bash) -F moduleA
- stage: Unit tests # golang
os: linux
script:
- set -e # Fail the whole script whenever any command fails
- |
cd "${CLI_FOLDER}"
go test -race -coverprofile=coverage.txt -covermode=atomic -v ./...
cd ..
- |
cd "${API_FOLDER}"
go test -coverprofile=coverage.txt -covermode=atomic -v ./handlers/... ./ws/... ./utils/...
cd ..
- |
cd "${OS_ROUTE_SVC_FOLDER}"
go test -race -coverprofile=coverage.txt -covermode=atomic -v ./...
cd ../..
- |
cd "${JMETER_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${HELM_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${GATEKEEPER_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${DISTRIBUTOR_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${EVENTBROKER_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd ${SHIPYARD_SVC_FOLDER}
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${CONFIGURATION_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${REMEDIATION_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${WAIT_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${LIGHTHOUSE_SVC_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- |
cd "${MONGODB_DS_FOLDER}"
go test -race -v -coverprofile=coverage.txt -covermode=atomic ./...
cd ..
- set +e # revert set -e from above
after_success:
- bash <(curl -s https://codecov.io/bash)
##################################################################################
# Jobs for the master branch
##################################################################################
- stage: Build Docker Images
if: branch = master AND (type = cron or type = push)
os: linux
services:
- docker
script:
- export VERSION="master+${DATE}"
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin
- ./writeManifest.sh
- cat MANIFEST
- source ./travis-scripts/build_develop.sh "${API_IMAGE}" "${API_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${OS_ROUTE_SVC_IMAGE}" "${OS_ROUTE_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${BRIDGE_IMAGE}" "${BRIDGE_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${JMETER_SVC_IMAGE}" "${JMETER_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${HELM_SVC_IMAGE}" "${HELM_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${GATEKEEPER_SVC_IMAGE}" "${GATEKEEPER_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${DISTRIBUTOR_IMAGE}" "${DISTRIBUTOR_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${EVENTBROKER_IMAGE}" "${EVENTBROKER_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${SHIPYARD_SVC_IMAGE}" "${SHIPYARD_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${CONFIGURATION_SVC_IMAGE}" "${CONFIGURATION_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${REMEDIATION_SVC_IMAGE}" "${REMEDIATION_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${WAIT_SVC_IMAGE}" "${WAIT_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${LIGHTHOUSE_SVC_IMAGE}" "${LIGHTHOUSE_SVC_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${MONGODB_DS_IMAGE}" "${MONGODB_DS_FOLDER}" "${GIT_SHA}" "${DATE}"
- source ./travis-scripts/build_develop.sh "${INSTALLER_IMAGE}" "${INSTALLER_FOLDER}" "${GIT_SHA}" "${DATE}"
### ATTENTION: please make sure installer is always the last in this list to be built
after_script:
- echo "The following images have been built and pushed to dockerhub:"
- docker images | grep keptn
- stage: Build CLI (OSX, Windows, Linux)
if: branch = master AND (type = cron OR type = push)
os: osx
before_script:
- source ./travis-scripts/install_gcloud.sh
- echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ~/gcloud-service-key.json
- gcloud auth activate-service-account --key-file ~/gcloud-service-key.json
script:
- |
if [[ $CHANGED_FILES == *"${CLI_FOLDER}"* ]]; then
echo "Build keptn cli"
cd ./cli
go test ./...
TAG="latest"
VERSION="master+${DATE}"
source ../travis-scripts/build_cli.sh "${VERSION}" "${KUBE_CONSTRAINTS}"
cd ..
fi
##################################################################################
# feature/bug/hotfix/patch branches build jobs
##################################################################################
- stage: Partial Build for feature/bug/hotfix/patch branches (CLI + Docker Images)
if: branch =~ ^feature.*$ OR branch =~ ^bug.*$ OR branch =~ ^hotfix.*$ OR branch =~ ^patch.*$
os: osx
before_script:
- source ./travis-scripts/install_gcloud.sh
- echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ~/gcloud-service-key.json
- gcloud auth activate-service-account --key-file ~/gcloud-service-key.json
script:
- TYPE="$(echo $TRAVIS_BRANCH | cut -d'/' -f1)"
- NUMBER="$(echo $TRAVIS_BRANCH | cut -d'/' -f2)"
- |
if [[ $CHANGED_FILES == *"${CLI_FOLDER}"* ]]; then
echo "Build keptn cli"
cd ./cli
go test ./...
TAG="${TYPE}-${NUMBER}+${DATE}"
source ../travis-scripts/build_cli.sh "${TAG}" "${KUBE_CONSTRAINTS}"
cd ..
fi
- if: branch =~ ^feature.*$ OR branch =~ ^bug.*$ OR branch =~ ^hotfix.*$ OR branch =~ ^patch.*$
os: linux
services:
- docker
script:
- set -e # Fail the whole script whenever any command fails
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin
- ./writeManifest.sh
- TYPE="$(echo $TRAVIS_BRANCH | cut -d'/' -f1)"
- NUMBER="$(echo $TRAVIS_BRANCH | cut -d'/' -f2)"
- |
if [[ $CHANGED_FILES == *"${API_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${API_IMAGE}" "${API_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${OS_ROUTE_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${OS_ROUTE_SVC_IMAGE}" "${OS_ROUTE_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${BRIDGE_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${BRIDGE_IMAGE}" "${BRIDGE_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${JMETER_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${JMETER_SVC_IMAGE}" "${JMETER_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${HELM_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${HELM_SVC_IMAGE}" "${HELM_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${GATEKEEPER_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${GATEKEEPER_SVC_IMAGE}" "${GATEKEEPER_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${DISTRIBUTOR_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${DISTRIBUTOR_IMAGE}" "${DISTRIBUTOR_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${EVENTBROKER_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${EVENTBROKER_IMAGE}" "${EVENTBROKER_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${SHIPYARD_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${SHIPYARD_SVC_IMAGE}" "${SHIPYARD_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${CONFIGURATION_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${CONFIGURATION_SVC_IMAGE}" "${CONFIGURATION_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${REMEDIATION_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${REMEDIATION_SVC_IMAGE}" "${REMEDIATION_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${WAIT_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${WAIT_SVC_IMAGE}" "${WAIT_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${LIGHTHOUSE_SVC_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${LIGHTHOUSE_SVC_IMAGE}" "${LIGHTHOUSE_SVC_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${MONGODB_DS_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${MONGODB_DS_IMAGE}" "${MONGODB_DS_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
- |
if [[ $CHANGED_FILES == *"${INSTALLER_FOLDER}"* ]]; then
source ./travis-scripts/build_feature.sh "${INSTALLER_IMAGE}" "${INSTALLER_FOLDER}" "${GIT_SHA}" "${TYPE}" "${NUMBER}" "${DATE}"
fi
### ATTENTION: please make sure installer is always the last in this list to be built
- set +e # revert set -e from above
after_script:
- echo "The following images have been built and pushed to dockerhub:"
- docker images | grep keptn
##################################################################################
# Release specific jobs
##################################################################################
- stage: Release Build CLI
if: branch =~ ^release.*$ AND NOT type = pull_request
os: osx
before_script:
- source ./travis-scripts/install_gcloud.sh
- echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ~/gcloud-service-key.json
- gcloud auth activate-service-account --key-file ~/gcloud-service-key.json
script:
# overwrite version for release branches based on the branch name
- export VERSION=${BRANCH#"release-"}
- echo "Build keptn cli"
- cd ./cli
- go test ./...
- TAG="${VERSION}"
- source ../travis-scripts/build_cli.sh "${VERSION}" "${KUBE_CONSTRAINTS}"
- cd ..
- stage: Release Build Docker Images (Part 1/2)
if: branch =~ ^release.*$ AND NOT type = pull_request
os: linux
services:
- docker
script:
- set -e # Fail the whole script whenever any command fails
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin
# overwrite version for release branches based on the branch name
- export VERSION=${BRANCH#"release-"}
- ./writeManifest.sh
- source ./travis-scripts/build_release.sh "${API_IMAGE}" "${API_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${OS_ROUTE_SVC_IMAGE}" "${OS_ROUTE_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${BRIDGE_IMAGE}" "${BRIDGE_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${JMETER_SVC_IMAGE}" "${JMETER_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${HELM_SVC_IMAGE}" "${HELM_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${GATEKEEPER_SVC_IMAGE}" "${GATEKEEPER_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${DISTRIBUTOR_IMAGE}" "${DISTRIBUTOR_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${EVENTBROKER_IMAGE}" "${EVENTBROKER_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- set +e # revert set -e from above
after_script:
- echo "The following images have been built and pushed to dockerhub:"
- docker images | grep keptn
- stage: Release Build Docker Images (Part 2/2)
if: branch =~ ^release.*$ AND NOT type = pull_request
os: linux
services:
- docker
script:
- set -e # Fail the whole script whenever any command fails
- echo "$REGISTRY_PASSWORD" | docker login --username $REGISTRY_USER --password-stdin
# overwrite version for release branches based on the branch name
- export VERSION=${BRANCH#"release-"}
- ./writeManifest.sh
- source ./travis-scripts/build_release.sh "${SHIPYARD_SVC_IMAGE}" "${SHIPYARD_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${CONFIGURATION_SVC_IMAGE}" "${CONFIGURATION_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${REMEDIATION_SVC_IMAGE}" "${REMEDIATION_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${WAIT_SVC_IMAGE}" "${WAIT_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${LIGHTHOUSE_SVC_IMAGE}" "${LIGHTHOUSE_SVC_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${MONGODB_DS_IMAGE}" "${MONGODB_DS_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- source ./travis-scripts/build_release.sh "${INSTALLER_IMAGE}" "${INSTALLER_FOLDER}" "${GIT_SHA}" "${DATE}" "${VERSION}"
- set +e # revert set -e from above
after_script:
- echo "The following images have been built and pushed to dockerhub:"
- docker images | grep keptn
- stage: Test GKE Full (--platform=gke)
if: branch = master AND type = cron # run for cron
env:
- GKE_VERSION=1.14
- KEPTN_INSTALLATION_TYPE=FULL
<<: *gke_full # use template
# - stage: Test GKE Full (--platform=gke)
# if: branch = master AND type = cron # run for cron
# env:
# - GKE_VERSION=1.15
# - KEPTN_INSTALLATION_TYPE=FULL
# <<: *gke_full # use template
- stage: Test GKE Full (--platform=gke)
if: branch = master AND type = cron # run for cron
env:
- GKE_VERSION=1.16
- KEPTN_INSTALLATION_TYPE=FULL
<<: *gke_full # use template
# Test GKE with 1.17 (not available yet)
# - stage: Test GKE Full (--platform=gke)
# if: branch = master AND type = cron # run for cron
# env:
# - GKE_VERSION=1.17
# - KEPTN_INSTALLATION_TYPE=FULL
# <<: *gke_full # use template
- stage: Test GKE Full with Istio (--platform=gke --ingress-install-option=Reuse)
if: branch = master AND type = cron # run for cron
env:
- KEPTN_INSTALLATION_TYPE=REUSE-ISTIO
- GKE_VERSION=1.14
<<: *gke_full # use template
# - stage: Test GKE Full with Istio (--platform=gke --ingress-install-option=Reuse)
# if: branch = master AND type = cron # run for cron
# env:
# - KEPTN_INSTALLATION_TYPE=REUSE-ISTIO
# - GKE_VERSION=1.15
# <<: *gke_full # use template
- stage: Test GKE Full with Istio (--platform=gke --ingress-install-option=Reuse)
if: branch = master AND type = cron # run for cron
env:
- KEPTN_INSTALLATION_TYPE=REUSE-ISTIO
- GKE_VERSION=1.16
<<: *gke_full # use template
# Test GKE with 1.17 (not available yet)
# - stage: Test GKE Full with Istio (--platform=gke --ingress-install-option=Reuse)
# if: branch = master AND type = cron # run for cron
# env:
# - KEPTN_INSTALLATION_TYPE=REUSE-ISTIO
# - GKE_VERSION=1.17
# <<: *gke_full # use template
- stage: Test Minishift Standalone (--platform=openshift --use-case=quality-gates)
if: (branch = master or branch =~ ^release.*$) AND (type = cron OR type = push) # run for any change on master/release-* on push as well as cron
os: linux
before_script:
# download and install kubectl
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
- test/utils/download_and_install_keptn_cli.sh
- test/utils/download_and_install_oc_cli.sh
- test/utils/minishift_create_cluster.sh
script:
- kubectl get nodes || travis_terminate 1 # sanity check that the K8s cluster is available
# finally install keptn quality gates
- test/test_install_minishift_quality_gates.sh
- keptn status
- export PROJECT=musicshop
- test/test_quality_gates_standalone.sh
after_success:
# delete kubernetes cluster only on success (in case of an error we want to be able to dig into the cluster)
- echo "Tests were successful, cleaning up the cluster now..."
after_failure:
# print some debug info
- cat ~/.keptn/keptn-installer.log
- kubectl get events --sort-by='.lastTimestamp' --all-namespaces
- kubectl get pods --all-namespaces
- kubectl get services --all-namespaces
- kubectl get ingress --all-namespaces
- &K3sStandaloneTest
stage: Test K3s Standalone (--platform=kubernetes --use-case=quality-gates)
if: (branch = master or branch =~ ^release.*$) AND (type = cron OR type = push) # run for any change on master/release-* on push as well as cron
os: linux
env:
- K3S_VERSION=v1.16.10+k3s1 # see https://github.com/rancher/k3s/releases
before_script:
# download and install kubectl
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
- test/utils/download_and_install_keptn_cli.sh
- test/utils/k3s_create_cluster.sh
- export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
script:
- kubectl get nodes || travis_terminate 1
- test/test_install_kubernetes_quality_gates.sh
- keptn status
- export PROJECT=musicshop
- test/test_quality_gates_standalone.sh
after_success:
# delete google kubernetes cluster only on success (in case of an error we want to be able to dig into the cluster)
- echo "Tests were successful, cleaning up the cluster now..."
after_failure:
# print some debug info
- echo "Keptn Installation Log:"
- cat ~/.keptn/keptn-installer.log
- kubectl get events --sort-by='.lastTimestamp' --all-namespaces
- kubectl get pods --all-namespaces
- kubectl get services --all-namespaces
- kubectl get ingress --all-namespaces
- <<: *K3sStandaloneTest
env:
- K3S_VERSION=v1.17.6+k3s1 # see https://github.com/rancher/k3s/releases
- <<: *K3sStandaloneTest
env:
- K3S_VERSION=v1.18.3+k3s1 # see https://github.com/rancher/k3s/releases
- µk8sStandaloneTest
stage: Test MicroK8s Standalone (--platform=kubernetes --use-case=quality-gates)
if: (branch = master or branch =~ ^release.*$) AND (type = cron OR type = push) # run for any change on master/release-* on push as well as cron
os: linux
env:
- MICROK8S_VERSION=1.16/stable # see https://snapcraft.io/microk8s channels
before_script:
# download and install kubectl
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
- test/utils/download_and_install_keptn_cli.sh
- test/utils/microk8s_create_cluster.sh
- export KUBECONFIG=~/kubeconfig
script:
- kubectl get nodes || travis_terminate 1 # sanity check that the K8s cluster is available
- test/test_install_kubernetes_quality_gates.sh
- keptn status
- export PROJECT=musicshop
- test/test_quality_gates_standalone.sh
after_success:
# delete kubernetes cluster only on success (in case of an error we want to be able to dig into the cluster)
- echo "Tests were successful, cleaning up the cluster now..."
after_failure:
# print some debug info
- cat ~/.keptn/keptn-installer.log
- kubectl get events --sort-by='.lastTimestamp' --all-namespaces
- kubectl get pods --all-namespaces
- kubectl get services --all-namespaces
- kubectl get ingress --all-namespaces
- <<: *microk8sStandaloneTest
env:
- MICROK8S_VERSION=1.17/stable # see https://snapcraft.io/microk8s channels
- <<: *microk8sStandaloneTest
env:
- MICROK8S_VERSION=1.18/stable # see https://snapcraft.io/microk8s channels
- &minikubeStandaloneTest
stage: Test Minikube Standalone (--platform=kubernetes --use-case=quality-gates)
# for detailed Minikube versions see https://github.com/kubernetes/minikube/blob/master/CHANGELOG.md
env:
- MINIKUBE_VERSION=v1.3.1 # from 2019-08-13; uses K8s 1.15
if: (branch = master or branch =~ ^release.*$) AND (type = cron OR type = push) # run for any change on master/release-* on push as well as cron
os: linux
before_script:
# install conntrack (required for newer minikube versions)
- sudo apt-get install -y conntrack
# download and install kubectl
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl && chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin/kubectl
- test/utils/download_and_install_keptn_cli.sh
- export USE_CASE=quality-gates
- test/utils/minikube_create_cluster.sh
script:
- kubectl get nodes || travis_terminate 1 # sanity check that the K8s cluster is available
# finally install keptn quality gates
- test/test_install_kubernetes_quality_gates.sh
- keptn status
- export PROJECT=musicshop
- test/test_quality_gates_standalone.sh
after_success:
# delete google kubernetes cluster only on success (in case of an error we want to be able to dig into the cluster)
- echo "Tests were successful, cleaning up the cluster now..."
after_failure:
# print some debug info
- cat ~/.keptn/keptn-installer.log
- kubectl get events --sort-by='.lastTimestamp' --all-namespaces
- kubectl get pods --all-namespaces
- kubectl get services --all-namespaces
- kubectl get ingress --all-namespaces
- <<: *minikubeStandaloneTest
env:
- MINIKUBE_VERSION=v1.4.0 # from 2019-09-17; uses K8s 1.16
- <<: *minikubeStandaloneTest
env:
- MINIKUBE_VERSION=v1.6.2 # from 2019-12-19; uses K8s 1.17
- <<: *minikubeStandaloneTest
env:
- MINIKUBE_VERSION=v1.7.3 # from 2020-02-20; uses K8s 1.17.3
- <<: *minikubeStandaloneTest
env:
- MINIKUBE_VERSION=v1.9.2 # from 2020-04-02; uses K8s 1.18
- <<: *minikubeStandaloneTest
env:
- MINIKUBE_VERSION=v1.10.1 # from 2020-05-12; uses K8s 1.18.2