-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
110 lines (108 loc) · 5.53 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
language: ruby
sudo: required
services:
- docker
before_install:
- echo "Installing test gems"
- gem install yaml-lint
- export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
- echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee
-a /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install -y dpkg
- sudo apt-get install google-cloud-sdk
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.10.5/bin/linux/amd64/kubectl;
chmod +x ./kubectl; sudo mv ./kubectl /usr/bin/
- sudo apt-get install jq
- echo $GCP_KEY_FILE | base64 -d > ./keyfile
- gcloud auth activate-service-account -q $(jq -r .client_email keyfile) --key-file=./keyfile
--project $(jq -r .project_id keyfile)
- rm ./keyfile
- export DESIRED_VERSION=; curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
| bash; helm version
install: true
script:
- pwd
- yaml-lint -n pubsubplus/*.yaml
- echo "Testing GKE deployment, cloud provider Google Cloud Platform (gcp) "
- mkdir gke_test; pushd gke_test
- export TESTCLUSTERNAME="sol-gke-travistest-$(date +%s)"
- wget https://raw.githubusercontent.com/SolaceProducts/solace-gke-quickstart/master/scripts/create_cluster.sh
- chmod 755 create_cluster.sh
- "./create_cluster.sh -z us-east4-a,us-east4-b,us-east4-c -c $TESTCLUSTERNAME -m e2-standard-2"
- gcloud container clusters get-credentials $TESTCLUSTERNAME --zone us-east4-a --project
capable-stream-180018
- popd
- kubectl get statefulset,svc,pods,pvc,pv
- #kubectl -n kube-system create serviceaccount tiller
- #kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
- #helm init --wait --service-account=tiller --upgrade
- #helm version
- helm lint pubsubplus
- helm install my-release pubsubplus --set solace.size=dev,solace.redundancy=true,solace.usernameAdminPassword=admin,image.repository=bczoma/solace-pubsub-standard,image.tag=test
- kubectl get statefulset,svc,pods,pvc,pv --show-labels
- echo "Waiting for cluster to become active"
- travis_wait 30 sleep 1800 &
- sleep 40; kubectl describe nodes
- until kubectl get pods --show-labels | grep pubsubplus-0 | grep -m 1 -E '1/1'; do sleep
10; done
- until kubectl get pods --show-labels | grep pubsubplus-1 | grep -m 1 -E '1/1'; do sleep
10; done
- until kubectl get pods --show-labels | grep pubsubplus-2 | grep -m 1 -E '1/1'; do sleep
10; done
- until kubectl get pods --show-labels | grep pubsubplus- | grep -m 1 -E 'active=true';
do sleep 10; done
- kubectl get statefulset,svc,pods,pvc,pv --show-labels
- bash -c 'if [[ `kubectl get po --show-labels | grep -c "1/1"` -ne 3 ]]; then echo
"Some pods are not ready!"; kubectl get po --show-labels; exit 1; fi'
- export url="$(kubectl get statefulset,svc,pods,pvc,pv --show-labels | grep LoadBalancer
| awk '{print $4}')"; echo $url
- curl -O https://sftp.solace.com/download/SDKPERF_C_LINUX64
- tar -xvf SDKPERF_C_LINUX64
- pubSubTools/sdkperf_c -cip=$url -mn=100000 -mr=0 -ptl=t1 -stl=t1 | grep "Total Messages"
- sleep 30
- bash -c 'if [[ -z `curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc><show><config-sync></config-sync></show></rpc>"
| grep "<oper-status>Up</oper-status>"` ]] ; then echo "config-sync not up!"; exit
1; fi'
- curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc><show><redundancy></redundancy></show></rpc>"
- curl -sS -u admin:admin http://$url:8080/SEMP -d "<rpc><show><config-sync></config-sync></show></rpc>"
- helm list
- helm delete $(helm list | grep deployed | awk '{print $1}')
- kubectl delete pvc --all
- bash docs/helm-charts/create-chart-variants.sh; # Create chart variants
- helm lint pubsubplus
- helm install --generate-name pubsubplus --dry-run
- helm lint pubsubplus-ha
- helm install --generate-name pubsubplus-ha --dry-run
- helm lint pubsubplus-dev
- helm install --generate-name pubsubplus-dev --dry-run
- # Publish to gh-pages and test
- >
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
git config --global user.email "[email protected]";
git config --global user.name "travis-ci";
mkdir gh-pages; # Now update gh-pages
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/SolaceProducts/pubsubplus-kubernetes-quickstart gh-pages > /dev/null 2>&1;
mv pubsubplus-*.tgz gh-pages/helm-charts/;
helm repo index gh-pages/helm-charts/ --url https://solaceproducts.github.io/pubsubplus-kubernetes-quickstart/helm-charts;
pushd gh-pages;
git add -f .;
git commit -m "Latest helm chart updates on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages";
git remote add origin-pages https://${GH_TOKEN}@github.com/SolaceProducts/pubsubplus-kubernetes-quickstart.git > /dev/null 2>&1;
git push --quiet --set-upstream origin-pages gh-pages;
echo "Updated and pushed GH pages!";
popd;
# sleep 60; # Ensure pages updated
# bash docs/helm-charts/test-chart-variants-from-gh-pages.sh https://solaceproducts.github.io/pubsubplus-kubernetes-quickstart/helm-charts;
fi
after_success:
- echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
- echo "YAML linted"
- echo "GKE cluster deployment tested"
- echo "Messaging tested"
- echo "Chart ha and dev variants created and smoke-tested"
after_script:
- gcloud container clusters delete $TESTCLUSTERNAME --quiet --zone us-east4-a
- gcloud compute disks list | grep travis | sed 1d $rpt | while read -r a b c; do
gcloud compute disks delete $a --zone $b --quiet; done