blob: 1cca12a1713ddf920b663805dcb1be7345cc10af [file] [log] [blame]
Kailash46a2a9a2019-01-23 12:39:04 -08001// Copyright 2017-present Open Networking Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// chart-api-test-helm.groovy
16// Checks functionality of the helm-chart, without overriding the version/tag used
17
18pipeline {
19
20 /* no label, executor is determined by JJB */
21 agent {
22 label "${params.executorNode}"
23 }
24
25 stages {
26
27 stage('repo') {
28 steps {
29 checkout(changelog: false, \
30 poll: false,
31 scm: [$class: 'RepoScm', \
32 manifestRepositoryUrl: "${params.manifestUrl}", \
33 manifestBranch: "${params.manifestBranch}", \
34 currentBranch: true, \
35 destinationDir: 'cord', \
36 forceSync: true,
37 resetFirst: true, \
38 quiet: true, \
39 jobs: 4, \
40 showAllChanges: true] \
41 )
42 }
43 }
44
45 stage('minikube') {
46 steps {
47 /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */
48 sh '''
49 export MINIKUBE_WANTUPDATENOTIFICATION=false
50 export MINIKUBE_WANTREPORTERRORPROMPT=false
51 export CHANGE_MINIKUBE_NONE_USER=true
52 export MINIKUBE_HOME=$HOME
53 mkdir -p $HOME/.kube || true
54 touch $HOME/.kube/config
55 export KUBECONFIG=$HOME/.kube/config
56 sudo -E /usr/bin/minikube start --vm-driver=none
57 '''
58 script {
59 timeout(3) {
60 waitUntil {
61 sleep 5
62 def kc_ret = sh script: "kubectl get po", returnStatus: true
63 return (kc_ret == 0);
64 }
65 }
66 }
67 }
68 }
69
70 stage('helm') {
71 steps {
72 sh '''
73 helm init
74 sleep 60
75 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
76 helm repo add cord https://charts.opencord.org
77 helm repo update
78 '''
79 }
80 }
81
82 stage('Build BBSIM') {
83 steps {
84 sh '''
85 git clone https://github.com/opencord/voltha-bbsim
86 cd voltha-bbsim/
87 make docker
Kailashff5c5402019-01-28 15:47:54 -080088 docker images | grep bbsim
Kailash46a2a9a2019-01-23 12:39:04 -080089 '''
90 }
91 }
92
93 stage('Install BBSIM w/SEBA') {
94 steps {
95 sh """
96 #!/usr/bin/env bash
97 set -eu -o pipefail
98
Kailashff5c5402019-01-28 15:47:54 -080099 git clone https://gerrit.opencord.org/pod-configs
Kailash46a2a9a2019-01-23 12:39:04 -0800100 pushd cord/helm-charts
101
102 helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka
103
104 git clone https://gerrit.opencord.org/helm-repo-tools
105 helm-repo-tools/wait_for_pods.sh
106
107 helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator
Kailashff5c5402019-01-28 15:47:54 -0800108 sleep 120
Kailash46a2a9a2019-01-23 12:39:04 -0800109 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
110
111 helm dep up voltha
Kailashff5c5402019-01-28 15:47:54 -0800112 helm install -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} voltha -n voltha
113 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh voltha
114
115 helm dep up onos
116 helm install onos -n onos -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
117 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
Kailash46a2a9a2019-01-23 12:39:04 -0800118
119 helm dep up xos-core
Kailash0db702b2019-01-29 13:54:19 -0800120 helm install xos-core -n xos-core
Kailash46a2a9a2019-01-23 12:39:04 -0800121
122 helm dep update xos-profiles/seba-services
Kailash0db702b2019-01-29 13:54:19 -0800123 helm install xos-profiles/seba-services -n seba-services
Kailashff5c5402019-01-28 15:47:54 -0800124 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
125
Kailash0db702b2019-01-29 13:54:19 -0800126 helm dep update xos-profiles/base-kubernetes
127 helm install xos-profiles/base-kubernetes -n base-kubernetes
Kailash46a2a9a2019-01-23 12:39:04 -0800128
129 helm dep update workflows/att-workflow
Kailash0db702b2019-01-29 13:54:19 -0800130 helm install workflows/att-workflow -n att-workflow --set att-workflow-driver.kafkaService=cord-kafka
Kailash46a2a9a2019-01-23 12:39:04 -0800131
132 # wait for services to load
133 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
Kailashff5c5402019-01-28 15:47:54 -0800134
Kailash46a2a9a2019-01-23 12:39:04 -0800135 echo "# Checking helm deployments"
136 kubectl get pods
137 helm list
138
Kailashff5c5402019-01-28 15:47:54 -0800139 helm install --set images.bbsim.tag=latest --set images.bbsim.pullPolicy=IfNotPresent bbsim -n bbsim
Kailash46a2a9a2019-01-23 12:39:04 -0800140 for hchart in \$(helm list -q);
141 do
142 echo "## 'helm status' for chart: \${hchart} ##"
143 helm status "\${hchart}"
144 done
Kailashff5c5402019-01-28 15:47:54 -0800145 kubectl get pods -n voltha -o json
Kailash46a2a9a2019-01-23 12:39:04 -0800146 popd
147 """
148 }
149 }
150
151 stage('Load BBSIM Tosca') {
152 steps {
153 sh '''
154 #!/usr/bin/env bash
155 set -eu -o pipefail
156
157 pushd cord/helm-charts
158
159 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @examples/bbsim-dhcp.yaml http://127.0.0.1:30007/run
160 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @examples/bbsim-16.yaml http://127.0.0.1:30007/run
161
162 popd
163 '''
164 }
165 }
166 stage('Test BBSIM') {
167 steps {
168 sh '''
169 #!/usr/bin/env bash
170 set -eu -o pipefail
171
172 helm test --timeout 1000 bbsim || true
Kailash46a2a9a2019-01-23 12:39:04 -0800173 '''
174 }
175 }
176 }
177 post {
178 always {
179 sh '''
180
181 kubectl logs bbsim-api-test --namespace default
182 kubectl get pods --all-namespaces
183
Kailash46a2a9a2019-01-23 12:39:04 -0800184 # copy robot logs
185 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
186 cp -r /tmp/helm_test_bbsim_logs_*/*ml ./RobotLogs
187
188 echo "# removing helm deployments"
189 kubectl get pods
190 helm list
191
192 for hchart in \$(helm list -q);
193 do
194 echo "## Purging chart: \${hchart} ##"
195 helm delete --purge "\${hchart}"
196 done
197
198 sudo minikube delete
199 '''
200 step([$class: 'RobotPublisher',
201 disableArchiveOutput: false,
202 logFileName: 'RobotLogs/log*.html',
203 otherFiles: '',
204 outputFileName: 'RobotLogs/output*.xml',
205 outputPath: '.',
206 passThreshold: 100,
207 reportFileName: 'RobotLogs/report*.html',
208 unstableThreshold: 0]);
209 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false])
210
211 }
212 }
213}