blob: f9a079c47f8b79838acf87fc9578c5515538c5a3 [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
Kailashe4ac2862019-03-21 12:03:40 -070045 stage('Clean up') {
Kailash46a2a9a2019-01-23 12:39:04 -080046 steps {
Kailashe4ac2862019-03-21 12:03:40 -070047 sh """
48 rm -rf voltha-bbsim/
49 rm -rf pod-configs/
50 rm -rf cord/helm-charts/helm-repo-tools/
51 for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
52 do
53 echo "Purging chart: \${hchart}"
54 helm delete --purge "\${hchart}"
55 done
56 """
Kailash46a2a9a2019-01-23 12:39:04 -080057 }
58 }
59
60 stage('Build BBSIM') {
61 steps {
62 sh '''
63 git clone https://github.com/opencord/voltha-bbsim
64 cd voltha-bbsim/
Kailashff5c5402019-01-28 15:47:54 -080065 docker images | grep bbsim
Kailash46a2a9a2019-01-23 12:39:04 -080066 '''
67 }
68 }
69
70 stage('Install BBSIM w/SEBA') {
71 steps {
72 sh """
73 #!/usr/bin/env bash
74 set -eu -o pipefail
75
Kailashff5c5402019-01-28 15:47:54 -080076 git clone https://gerrit.opencord.org/pod-configs
Kailash46a2a9a2019-01-23 12:39:04 -080077 pushd cord/helm-charts
78
79 helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka
80
81 git clone https://gerrit.opencord.org/helm-repo-tools
82 helm-repo-tools/wait_for_pods.sh
83
84 helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator
Kailashe4ac2862019-03-21 12:03:40 -070085 sleep 60
Kailash46a2a9a2019-01-23 12:39:04 -080086 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
87
88 helm dep up voltha
Kailashff5c5402019-01-28 15:47:54 -080089 helm install -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} voltha -n voltha
90 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh voltha
91
92 helm dep up onos
93 helm install onos -n onos -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig}
94 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
Kailash46a2a9a2019-01-23 12:39:04 -080095
96 helm dep up xos-core
Kailash0db702b2019-01-29 13:54:19 -080097 helm install xos-core -n xos-core
Kailash46a2a9a2019-01-23 12:39:04 -080098
99 helm dep update xos-profiles/seba-services
Kailash0db702b2019-01-29 13:54:19 -0800100 helm install xos-profiles/seba-services -n seba-services
Kailashff5c5402019-01-28 15:47:54 -0800101 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh
102
Kailash0db702b2019-01-29 13:54:19 -0800103 helm dep update xos-profiles/base-kubernetes
104 helm install xos-profiles/base-kubernetes -n base-kubernetes
Kailash46a2a9a2019-01-23 12:39:04 -0800105
106 helm dep update workflows/att-workflow
Kailash0db702b2019-01-29 13:54:19 -0800107 helm install workflows/att-workflow -n att-workflow --set att-workflow-driver.kafkaService=cord-kafka
Kailash46a2a9a2019-01-23 12:39:04 -0800108
109 # wait for services to load
110 JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh
Kailashff5c5402019-01-28 15:47:54 -0800111
Kailash46a2a9a2019-01-23 12:39:04 -0800112 echo "# Checking helm deployments"
113 kubectl get pods
114 helm list
115
Kailashe4ac2862019-03-21 12:03:40 -0700116 helm install --set images.bbsim.tag=latest --set images.bbsim.pullPolicy=IfNotPresent --set onus_per_pon_port=${params.OnuCount} ${params.EmulationMode} bbsim -n bbsim
Kailash46a2a9a2019-01-23 12:39:04 -0800117 for hchart in \$(helm list -q);
118 do
119 echo "## 'helm status' for chart: \${hchart} ##"
120 helm status "\${hchart}"
121 done
122 popd
123 """
124 }
125 }
Kailashd0294882019-03-19 13:23:32 -0700126 stage('Load BBSIM-DHCP Tosca') {
127 steps {
128 sh '''
129 #!/usr/bin/env bash
130 set -eu -o pipefail
131 pushd cord/helm-charts
132 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
133 popd
134 '''
135 }
136 }
Kailash46a2a9a2019-01-23 12:39:04 -0800137 stage('Test BBSIM') {
138 steps {
Kailashef0be3d2019-03-19 09:21:22 -0700139 sh """
Kailash46a2a9a2019-01-23 12:39:04 -0800140 #!/usr/bin/env bash
141 set -eu -o pipefail
Kailashe4ac2862019-03-21 12:03:40 -0700142 pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim
Kailashf1375442019-03-21 18:02:58 -0700143 robot -e serviceinstances -e onosdhcp -e notready -v number_of_onus:${params.OnuCount} -v timeout:${params.TestTimeout} BBSIMScale.robot || true
Kailashef0be3d2019-03-19 09:21:22 -0700144 """
Kailash46a2a9a2019-01-23 12:39:04 -0800145 }
146 }
147 }
Kailashd0294882019-03-19 13:23:32 -0700148
Kailash46a2a9a2019-01-23 12:39:04 -0800149 post {
150 always {
151 sh '''
Kailash46a2a9a2019-01-23 12:39:04 -0800152 kubectl get pods --all-namespaces
Kailashc06c9b62019-02-25 10:01:24 -0800153 ## get default pod logs
Kailash2c1900c2019-02-11 12:18:27 -0800154 for pod in \$(kubectl get pods --no-headers | awk '{print \$1}');
155 do
156 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
157 kubectl logs \$pod onos> $WORKSPACE/\$pod.log;
158 else
159 kubectl logs \$pod> $WORKSPACE/\$pod.log;
160 fi
161 done
Kailash46a2a9a2019-01-23 12:39:04 -0800162
Kailashc06c9b62019-02-25 10:01:24 -0800163 ## get voltha pod logs
164 for pod in \$(kubectl get pods -n voltha --no-headers | awk '{print \$1}');
165 do
166 if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then
167 kubectl logs -n voltha \$pod onos> $WORKSPACE/\$pod.log;
168 else
169 kubectl logs -n voltha \$pod> $WORKSPACE/\$pod.log;
170 fi
171 done
172
Kailash46a2a9a2019-01-23 12:39:04 -0800173 # copy robot logs
174 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
Kailashf2688e02019-03-18 21:11:13 -0700175 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/BBSim/*ml ./RobotLogs
Kailash46a2a9a2019-01-23 12:39:04 -0800176
177 echo "# removing helm deployments"
178 kubectl get pods
179 helm list
Kailash46a2a9a2019-01-23 12:39:04 -0800180 '''
181 step([$class: 'RobotPublisher',
182 disableArchiveOutput: false,
183 logFileName: 'RobotLogs/log*.html',
184 otherFiles: '',
185 outputFileName: 'RobotLogs/output*.xml',
186 outputPath: '.',
187 passThreshold: 100,
188 reportFileName: 'RobotLogs/report*.html',
189 unstableThreshold: 0]);
Kailash2c1900c2019-02-11 12:18:27 -0800190 archiveArtifacts artifacts: '*.log'
Kailash46a2a9a2019-01-23 12:39:04 -0800191 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false])
192
193 }
194 }
195}