blob: 6f4d92c506cc124b63389b6c5df11073e0ba9dc2 [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
88 '''
89 }
90 }
91
92 stage('Install BBSIM w/SEBA') {
93 steps {
94 sh """
95 #!/usr/bin/env bash
96 set -eu -o pipefail
97
98 pushd cord/helm-charts
99
100 helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka
101
102 git clone https://gerrit.opencord.org/helm-repo-tools
103 helm-repo-tools/wait_for_pods.sh
104
105 helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator
106 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
107
108 helm dep up voltha
109 helm install voltha -n voltha
110 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
111
112 helm dep up xos-core
113 helm install xos-core -n xos-core
114
115 helm dep update xos-profiles/seba-services
116 helm install \${helm_install_args} xos-profiles/seba-services
117 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
118
119 helm dep update workflows/att-workflow
120 helm install workflows/att-workflow -n att-workflow
121
122 helm install onos -n onos
123
124 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
125
126 # wait for services to load
127 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
128 sleep 300
129 echo "# Checking helm deployments"
130 kubectl get pods
131 helm list
132
133 helm install bbsim --set images.bbsim.tag:latest -n bbsim
134
135 for hchart in \$(helm list -q);
136 do
137 echo "## 'helm status' for chart: \${hchart} ##"
138 helm status "\${hchart}"
139 done
140 popd
141 """
142 }
143 }
144
145 stage('Load BBSIM Tosca') {
146 steps {
147 sh '''
148 #!/usr/bin/env bash
149 set -eu -o pipefail
150
151 pushd cord/helm-charts
152
153 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
154 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
155
156 popd
157 '''
158 }
159 }
160 stage('Test BBSIM') {
161 steps {
162 sh '''
163 #!/usr/bin/env bash
164 set -eu -o pipefail
165
166 helm test --timeout 1000 bbsim || true
167
168 popd
169 '''
170 }
171 }
172 }
173 post {
174 always {
175 sh '''
176
177 kubectl logs bbsim-api-test --namespace default
178 kubectl get pods --all-namespaces
179
180 # copy robot logs
181 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
182 cp -r /tmp/helm_test_bbsim_logs_*/*ml ./RobotLogs
183
184 echo "# removing helm deployments"
185 kubectl get pods
186 helm list
187
188 for hchart in \$(helm list -q);
189 do
190 echo "## Purging chart: \${hchart} ##"
191 helm delete --purge "\${hchart}"
192 done
193
194 sudo minikube delete
195 '''
196 step([$class: 'RobotPublisher',
197 disableArchiveOutput: false,
198 logFileName: 'RobotLogs/log*.html',
199 otherFiles: '',
200 outputFileName: 'RobotLogs/output*.xml',
201 outputPath: '.',
202 passThreshold: 100,
203 reportFileName: 'RobotLogs/report*.html',
204 unstableThreshold: 0]);
205 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false])
206
207 }
208 }
209}