This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
68 lines (60 loc) · 2.8 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
dist: xenial
sudo: required
addons:
apt:
packages:
- docker-ce
services:
- docker
language: python
stages:
- unit tests
- test
env:
- K8S_VERSION=v1.12.5
- K8S_VERSION=v1.13.3
jobs:
include:
- stage: unit tests
env:
install:
- docker build -t kbstci/memcached:$TRAVIS_COMMIT memcached_operator/
- docker images
script:
- docker run -v `pwd`/memcached_operator:/opt/memcached_operator:Z --rm --entrypoint "/bin/bash" -ti kbstci/memcached:$TRAVIS_COMMIT -c "pip install pipenv && pipenv install --dev && pipenv run nosetests"
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push kbstci/memcached:$TRAVIS_COMMIT
install:
# Download kubectl
- curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$K8S_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
# Download minikube
- curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
- CHANGE_MINIKUBE_NONE_USER=true sudo minikube start --vm-driver=none --kubernetes-version=$K8S_VERSION
# Set kubectl context
- CHANGE_MINIKUBE_NONE_USER=true minikube update-context
# Wait for Kubernetes to be up
- kubectl wait --for=condition=Ready --timeout=30s node/minikube
- kubectl -n kube-system wait --for=condition=Available --timeout=30s deployment/coredns
# Replace default image tag with CI tag
- sed -i "s/kubestack\/memcached:latest/kbstci\/memcached:$TRAVIS_COMMIT/" manifests/memcached.json
# Apply CRD, RBAC, Operator and CO
- until kubectl get memcached memc; do kubectl apply -f manifests/memcached.json; done
script:
# Wait until operator is deployed
- kubectl -n kubestack wait --for=condition=Ready --timeout=30s pod -l operator=memcached.operator.kubestack.com
- kubectl get pod -n kubestack -l operator=memcached.operator.kubestack.com
# Wait until operator created resources
- sleep 30
- kubectl -n default wait --for=condition=Available --timeout=30s deploy/memc
- kubectl -n default wait --for=condition=Available --timeout=30s deploy/memc-router
# Wait until all operated pods are Ready
- kubectl -n default wait --for=condition=Ready --timeout=30s pod -l operated-by=memcached.operator.kubestack.com
- kubectl get pod -n default -l operated-by=memcached.operator.kubestack.com
# Delete memcached custom object
- kubectl delete memcached memc
# Wait until all pods are deleted
- kubectl -n default wait --for=delete --timeout=30s pod -l operated-by=memcached.operator.kubestack.com
- kubectl get deploy -n default -l operated-by=memcached.operator.kubestack.com
- kubectl get pod -n default -l operated-by=memcached.operator.kubestack.com
# Print operator logs
- sleep 10 && kubectl -n kubestack logs -l operator=memcached.operator.kubestack.com