blob: 13513a165919def173a5abe1b18fa93895d26b95 [file] [log] [blame]
Joey Armstrong6a9013e2024-02-01 17:56:57 -05001// Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Kailash46a2a9a2019-01-23 12:39:04 -08002//
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 {
Zack Williamsb3292082019-10-11 17:15:18 -070022 label "${params.buildNode}"
Kailash46a2a9a2019-01-23 12:39:04 -080023 }
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
Kailashaf893c72019-06-26 14:36:55 -0700129 curl -H "xos-username: admin@opencord.org" -H "xos-password: letmein" -X POST --data-binary @examples/technology-profile.yaml http://127.0.0.1:30007/run
Kailashd0294882019-03-19 13:23:32 -0700130 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}
Joey Armstrong6a9013e2024-02-01 17:56:57 -0500204
205// [EOF]