blob: 0dd31f62f1cf2fa20dca566564ab8921c33aa171 [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
Kailash46a2a9a2019-01-23 12:39:04 -080077 helm-repo-tools/wait_for_pods.sh
78
79 helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator
Kailashe4ac2862019-03-21 12:03:40 -070080 sleep 60
Kailash46a2a9a2019-01-23 12:39:04 -080081 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
82
83 helm dep up voltha
Kailashff5c5402019-01-28 15:47:54 -080084 helm install -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} voltha -n voltha
85 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh voltha
86
87 helm dep up onos
88 helm install onos -n onos -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
89 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
Kailash46a2a9a2019-01-23 12:39:04 -080090
91 helm dep up xos-core
Kailash595a27e2019-03-22 19:53:14 -070092 helm install xos-core -n xos-core -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -080093
94 helm dep update xos-profiles/seba-services
Kailash595a27e2019-03-22 19:53:14 -070095 helm install xos-profiles/seba-services -n seba-services -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailashff5c5402019-01-28 15:47:54 -080096 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
97
Kailash0db702b2019-01-29 13:54:19 -080098 helm dep update xos-profiles/base-kubernetes
Kailash595a27e2019-03-22 19:53:14 -070099 helm install xos-profiles/base-kubernetes -n base-kubernetes -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
Kailash46a2a9a2019-01-23 12:39:04 -0800100
101 helm dep update workflows/att-workflow
Kailash595a27e2019-03-22 19:53:14 -0700102 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 -0800103
104 # wait for services to load
105 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
Kailashff5c5402019-01-28 15:47:54 -0800106
Kailash46a2a9a2019-01-23 12:39:04 -0800107 echo "# Checking helm deployments"
108 kubectl get pods
109 helm list
110
Kailashe4ac2862019-03-21 12:03:40 -0700111 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 -0700112
Kailash46a2a9a2019-01-23 12:39:04 -0800113 for hchart in \$(helm list -q);
114 do
115 echo "## 'helm status' for chart: \${hchart} ##"
116 helm status "\${hchart}"
117 done
118 popd
119 """
120 }
121 }
Kailashd0294882019-03-19 13:23:32 -0700122 stage('Load BBSIM-DHCP Tosca') {
123 steps {
124 sh '''
125 #!/usr/bin/env bash
126 set -eu -o pipefail
127 pushd cord/helm-charts
128 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
129 popd
130 '''
131 }
132 }
Kailash46a2a9a2019-01-23 12:39:04 -0800133 stage('Test BBSIM') {
134 steps {
Kailashef0be3d2019-03-19 09:21:22 -0700135 sh """
Kailash46a2a9a2019-01-23 12:39:04 -0800136 #!/usr/bin/env bash
137 set -eu -o pipefail
Kailashe4ac2862019-03-21 12:03:40 -0700138 pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim
Kailash595a27e2019-03-22 19:53:14 -0700139 robot -e notready -v number_of_onus:${params.OnuCount} -v timeout:${params.TestTimeout} ${params.TestTags} BBSIMScale.robot || true
Kailashef0be3d2019-03-19 09:21:22 -0700140 """
Kailash46a2a9a2019-01-23 12:39:04 -0800141 }
142 }
Kailash595a27e2019-03-22 19:53:14 -0700143 stage ('Display Kafka Events') {
144 steps {
145 sh """
146 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
147 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
148 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
149 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
150 """
151 }
152 }
Kailashd0294882019-03-19 13:23:32 -0700153
Kailash595a27e2019-03-22 19:53:14 -0700154 stage ('Archive Artifacts') {
Kailashaad0e712019-03-22 20:42:07 -0700155 when { expression { return params.ArchiveLogs } }
Kailash595a27e2019-03-22 19:53:14 -0700156 steps {
157 sh '''
158 kubectl get pods --all-namespaces
159 ## get default pod logs
160 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
161 do
162 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
163 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
164 else
165 kubectl logs \$pod> $WORKSPACE/\$pod.log;
166 fi
167 done
168 ## get voltha pod logs
169 for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}');
170 do
171 kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log;
172 done
173 '''
174 }
175 }
Kailashaad0e712019-03-22 20:42:07 -0700176 }
Kailash46a2a9a2019-01-23 12:39:04 -0800177 post {
178 always {
179 sh '''
Kailash46a2a9a2019-01-23 12:39:04 -0800180 # copy robot logs
181 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
Kailashf2688e02019-03-18 21:11:13 -0700182 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/BBSim/*ml ./RobotLogs
Kailash46a2a9a2019-01-23 12:39:04 -0800183
184 echo "# removing helm deployments"
185 kubectl get pods
186 helm list
Kailash46a2a9a2019-01-23 12:39:04 -0800187 '''
188 step([$class: 'RobotPublisher',
189 disableArchiveOutput: false,
190 logFileName: 'RobotLogs/log*.html',
191 otherFiles: '',
192 outputFileName: 'RobotLogs/output*.xml',
193 outputPath: '.',
194 passThreshold: 100,
195 reportFileName: 'RobotLogs/report*.html',
196 unstableThreshold: 0]);
Kailash2c1900c2019-02-11 12:18:27 -0800197 archiveArtifacts artifacts: '*.log'
Kailash46a2a9a2019-01-23 12:39:04 -0800198 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false])
199
200 }
201 }
202}