blob: 3dbd53e24ddc328eb3e0cc4f125f93d0cb0b52e8 [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 {
Kailash595a27e2019-03-22 19:53:14 -070026 stage('Clean up') {
27 steps {
28 sh """
29 rm -rf *
30 for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
31 do
32 echo "Purging chart: \${hchart}"
33 helm delete --purge "\${hchart}"
34 done
35 """
36 }
37 }
Kailash46a2a9a2019-01-23 12:39:04 -080038 stage('repo') {
39 steps {
40 checkout(changelog: false, \
41 poll: false,
42 scm: [$class: 'RepoScm', \
43 manifestRepositoryUrl: "${params.manifestUrl}", \
44 manifestBranch: "${params.manifestBranch}", \
45 currentBranch: true, \
46 destinationDir: 'cord', \
47 forceSync: true,
48 resetFirst: true, \
49 quiet: true, \
50 jobs: 4, \
51 showAllChanges: true] \
52 )
53 }
54 }
55
Kailash46a2a9a2019-01-23 12:39:04 -080056 stage('Build BBSIM') {
57 steps {
58 sh '''
59 git clone https://github.com/opencord/voltha-bbsim
60 cd voltha-bbsim/
Kailashff5c5402019-01-28 15:47:54 -080061 docker images | grep bbsim
Kailash46a2a9a2019-01-23 12:39:04 -080062 '''
63 }
64 }
65
66 stage('Install BBSIM w/SEBA') {
67 steps {
68 sh """
69 #!/usr/bin/env bash
70 set -eu -o pipefail
71
Kailashff5c5402019-01-28 15:47:54 -080072 git clone https://gerrit.opencord.org/pod-configs
Kailash46a2a9a2019-01-23 12:39:04 -080073 pushd cord/helm-charts
74
75 helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka
76
77 git clone https://gerrit.opencord.org/helm-repo-tools
78 helm-repo-tools/wait_for_pods.sh
79
80 helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator
Kailashe4ac2862019-03-21 12:03:40 -070081 sleep 60
Kailash46a2a9a2019-01-23 12:39:04 -080082 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
83
84 helm dep up voltha
Kailashff5c5402019-01-28 15:47:54 -080085 helm install -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} voltha -n voltha
86 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh voltha
87
88 helm dep up onos
89 helm install onos -n onos -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
90 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
Kailash46a2a9a2019-01-23 12:39:04 -080091
92 helm dep up xos-core
Kailash595a27e2019-03-22 19:53:14 -070093 helm install xos-core -n xos-core -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -080094
95 helm dep update xos-profiles/seba-services
Kailash595a27e2019-03-22 19:53:14 -070096 helm install xos-profiles/seba-services -n seba-services -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailashff5c5402019-01-28 15:47:54 -080097 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
98
Kailash0db702b2019-01-29 13:54:19 -080099 helm dep update xos-profiles/base-kubernetes
Kailash595a27e2019-03-22 19:53:14 -0700100 helm install xos-profiles/base-kubernetes -n base-kubernetes -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -0800101
102 helm dep update workflows/att-workflow
Kailash595a27e2019-03-22 19:53:14 -0700103 helm install workflows/att-workflow -n att-workflow --set att-workflow-driver.kafkaService=cord-kafka -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -0800104
105 # wait for services to load
106 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
Kailashff5c5402019-01-28 15:47:54 -0800107
Kailash46a2a9a2019-01-23 12:39:04 -0800108 echo "# Checking helm deployments"
109 kubectl get pods
110 helm list
111
Kailashe4ac2862019-03-21 12:03:40 -0700112 helm install --set images.bbsim.tag=latest --set images.bbsim.pullPolicy=IfNotPresent --set onus_per_pon_port=${params.OnuCount} ${params.EmulationMode} bbsim -n bbsim
Kailash595a27e2019-03-22 19:53:14 -0700113
Kailash46a2a9a2019-01-23 12:39:04 -0800114 for hchart in \$(helm list -q);
115 do
116 echo "## 'helm status' for chart: \${hchart} ##"
117 helm status "\${hchart}"
118 done
119 popd
120 """
121 }
122 }
Kailashd0294882019-03-19 13:23:32 -0700123 stage('Load BBSIM-DHCP Tosca') {
124 steps {
125 sh '''
126 #!/usr/bin/env bash
127 set -eu -o pipefail
128 pushd cord/helm-charts
129 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
130 popd
131 '''
132 }
133 }
Kailash46a2a9a2019-01-23 12:39:04 -0800134 stage('Test BBSIM') {
135 steps {
Kailashef0be3d2019-03-19 09:21:22 -0700136 sh """
Kailash46a2a9a2019-01-23 12:39:04 -0800137 #!/usr/bin/env bash
138 set -eu -o pipefail
Kailashe4ac2862019-03-21 12:03:40 -0700139 pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim
Kailash595a27e2019-03-22 19:53:14 -0700140 robot -e notready -v number_of_onus:${params.OnuCount} -v timeout:${params.TestTimeout} ${params.TestTags} BBSIMScale.robot || true
Kailashef0be3d2019-03-19 09:21:22 -0700141 """
Kailash46a2a9a2019-01-23 12:39:04 -0800142 }
143 }
Kailash595a27e2019-03-22 19:53:14 -0700144 stage ('Display Kafka Events') {
145 steps {
146 sh """
147 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
148 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
149 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
150 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
151 """
152 }
153 }
Kailashd0294882019-03-19 13:23:32 -0700154
Kailash595a27e2019-03-22 19:53:14 -0700155 stage ('Archive Artifacts') {
Kailashaad0e712019-03-22 20:42:07 -0700156 when { expression { return params.ArchiveLogs } }
Kailash595a27e2019-03-22 19:53:14 -0700157 steps {
158 sh '''
159 kubectl get pods --all-namespaces
160 ## get default pod logs
161 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
162 do
163 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
164 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
165 else
166 kubectl logs \$pod> $WORKSPACE/\$pod.log;
167 fi
168 done
169 ## get voltha pod logs
170 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
171 do
172 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
173 done
174 '''
175 }
176 }
Kailashaad0e712019-03-22 20:42:07 -0700177 }
Kailash46a2a9a2019-01-23 12:39:04 -0800178 post {
179 always {
180 sh '''
Kailash46a2a9a2019-01-23 12:39:04 -0800181 # copy robot logs
182 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
Kailashf2688e02019-03-18 21:11:13 -0700183 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/BBSim/*ml ./RobotLogs
Kailash46a2a9a2019-01-23 12:39:04 -0800184
185 echo "# removing helm deployments"
186 kubectl get pods
187 helm list
Kailash46a2a9a2019-01-23 12:39:04 -0800188 '''
189 step([$class: 'RobotPublisher',
190 disableArchiveOutput: false,
191 logFileName: 'RobotLogs/log*.html',
192 otherFiles: '',
193 outputFileName: 'RobotLogs/output*.xml',
194 outputPath: '.',
195 passThreshold: 100,
196 reportFileName: 'RobotLogs/report*.html',
197 unstableThreshold: 0]);
Kailash2c1900c2019-02-11 12:18:27 -0800198 archiveArtifacts artifacts: '*.log'
Kailash46a2a9a2019-01-23 12:39:04 -0800199 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false])
200
201 }
202 }
203}