Joey Armstrong | 56fdfec | 2024-03-01 13:43:36 -0500 | [diff] [blame^] | 1 | // ----------------------------------------------------------------------- |
| 2 | // Copyright 2017-2024 Open Networking Foundation Contributors |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
Joey Armstrong | 56fdfec | 2024-03-01 13:43:36 -0500 | [diff] [blame^] | 15 | // ----------------------------------------------------------------------- |
| 16 | // SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors |
| 17 | // SPDX-License-Identifier: Apache-2.0 |
| 18 | // ----------------------------------------------------------------------- |
| 19 | // Entropy: 0fcb5ffa-d1a4-11ee-be5e-9f44b7181764 |
| 20 | // ----------------------------------------------------------------------- |
| 21 | // Intent: chart-api-test-helm.groovy |
| 22 | // Checks functionality of the helm-chart, without overriding the ver/tag used |
| 23 | // ----------------------------------------------------------------------- |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 24 | |
| 25 | pipeline { |
| 26 | |
| 27 | /* no label, executor is determined by JJB */ |
| 28 | agent { |
Zack Williams | b329208 | 2019-10-11 17:15:18 -0700 | [diff] [blame] | 29 | label "${params.buildNode}" |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | stages { |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 33 | stage('Clean up') { |
| 34 | steps { |
| 35 | sh """ |
| 36 | rm -rf * |
| 37 | for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet'); |
| 38 | do |
| 39 | echo "Purging chart: \${hchart}" |
| 40 | helm delete --purge "\${hchart}" |
| 41 | done |
| 42 | """ |
| 43 | } |
| 44 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 45 | stage('repo') { |
| 46 | steps { |
| 47 | checkout(changelog: false, \ |
| 48 | poll: false, |
| 49 | scm: [$class: 'RepoScm', \ |
| 50 | manifestRepositoryUrl: "${params.manifestUrl}", \ |
| 51 | manifestBranch: "${params.manifestBranch}", \ |
| 52 | currentBranch: true, \ |
| 53 | destinationDir: 'cord', \ |
| 54 | forceSync: true, |
| 55 | resetFirst: true, \ |
| 56 | quiet: true, \ |
| 57 | jobs: 4, \ |
| 58 | showAllChanges: true] \ |
| 59 | ) |
| 60 | } |
| 61 | } |
| 62 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 63 | stage('Build BBSIM') { |
| 64 | steps { |
| 65 | sh ''' |
| 66 | git clone https://github.com/opencord/voltha-bbsim |
| 67 | cd voltha-bbsim/ |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 68 | docker images | grep bbsim |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 69 | ''' |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | stage('Install BBSIM w/SEBA') { |
| 74 | steps { |
| 75 | sh """ |
| 76 | #!/usr/bin/env bash |
| 77 | set -eu -o pipefail |
| 78 | |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 79 | git clone https://gerrit.opencord.org/pod-configs |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 80 | pushd cord/helm-charts |
| 81 | |
| 82 | helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka |
| 83 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 84 | helm-repo-tools/wait_for_pods.sh |
| 85 | |
| 86 | helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 87 | sleep 60 |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 88 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
| 89 | |
| 90 | helm dep up voltha |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 91 | helm install -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} voltha -n voltha |
| 92 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh voltha |
| 93 | |
| 94 | helm dep up onos |
| 95 | helm install onos -n onos -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} |
| 96 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 97 | |
| 98 | helm dep up xos-core |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 99 | helm install xos-core -n xos-core -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 100 | |
| 101 | helm dep update xos-profiles/seba-services |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 102 | helm install xos-profiles/seba-services -n seba-services -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 103 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
| 104 | |
Kailash | 0db702b | 2019-01-29 13:54:19 -0800 | [diff] [blame] | 105 | helm dep update xos-profiles/base-kubernetes |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 106 | helm install xos-profiles/base-kubernetes -n base-kubernetes -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 107 | |
| 108 | helm dep update workflows/att-workflow |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 109 | helm install workflows/att-workflow -n att-workflow --set att-workflow-driver.kafkaService=cord-kafka -f $WORKSPACE/pod-configs/kubernetes-configs/${params.deploymentConfig} |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 110 | |
| 111 | # wait for services to load |
| 112 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 113 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 114 | echo "# Checking helm deployments" |
| 115 | kubectl get pods |
| 116 | helm list |
| 117 | |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 118 | helm install --set images.bbsim.tag=latest --set images.bbsim.pullPolicy=IfNotPresent --set onus_per_pon_port=${params.OnuCount} ${params.EmulationMode} bbsim -n bbsim |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 119 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 120 | for hchart in \$(helm list -q); |
| 121 | do |
| 122 | echo "## 'helm status' for chart: \${hchart} ##" |
| 123 | helm status "\${hchart}" |
| 124 | done |
| 125 | popd |
| 126 | """ |
| 127 | } |
| 128 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 129 | stage('Load BBSIM-DHCP Tosca') { |
| 130 | steps { |
| 131 | sh ''' |
| 132 | #!/usr/bin/env bash |
| 133 | set -eu -o pipefail |
| 134 | pushd cord/helm-charts |
| 135 | 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 |
Kailash | af893c7 | 2019-06-26 14:36:55 -0700 | [diff] [blame] | 136 | 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 |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 137 | popd |
| 138 | ''' |
| 139 | } |
| 140 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 141 | stage('Test BBSIM') { |
| 142 | steps { |
Kailash | ef0be3d | 2019-03-19 09:21:22 -0700 | [diff] [blame] | 143 | sh """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 144 | #!/usr/bin/env bash |
| 145 | set -eu -o pipefail |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 146 | pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 147 | robot -e notready -v number_of_onus:${params.OnuCount} -v timeout:${params.TestTimeout} ${params.TestTags} BBSIMScale.robot || true |
Kailash | ef0be3d | 2019-03-19 09:21:22 -0700 | [diff] [blame] | 148 | """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 149 | } |
| 150 | } |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 151 | stage ('Display Kafka Events') { |
| 152 | steps { |
| 153 | sh """ |
| 154 | CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192) |
| 155 | kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0' |
| 156 | kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0' |
| 157 | kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0' |
| 158 | """ |
| 159 | } |
| 160 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 161 | |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 162 | stage ('Archive Artifacts') { |
Kailash | aad0e71 | 2019-03-22 20:42:07 -0700 | [diff] [blame] | 163 | when { expression { return params.ArchiveLogs } } |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 164 | steps { |
| 165 | sh ''' |
| 166 | kubectl get pods --all-namespaces |
| 167 | ## get default pod logs |
| 168 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 169 | do |
| 170 | if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then |
| 171 | kubectl logs \$pod onos> $WORKSPACE/\$pod.log; |
| 172 | else |
| 173 | kubectl logs \$pod> $WORKSPACE/\$pod.log; |
| 174 | fi |
| 175 | done |
| 176 | ## get voltha pod logs |
| 177 | for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}'); |
| 178 | do |
| 179 | kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log; |
| 180 | done |
| 181 | ''' |
| 182 | } |
| 183 | } |
Kailash | aad0e71 | 2019-03-22 20:42:07 -0700 | [diff] [blame] | 184 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 185 | post { |
| 186 | always { |
| 187 | sh ''' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 188 | # copy robot logs |
| 189 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Kailash | f2688e0 | 2019-03-18 21:11:13 -0700 | [diff] [blame] | 190 | cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/BBSim/*ml ./RobotLogs |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 191 | |
| 192 | echo "# removing helm deployments" |
| 193 | kubectl get pods |
| 194 | helm list |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 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]); |
Kailash | 2c1900c | 2019-02-11 12:18:27 -0800 | [diff] [blame] | 205 | archiveArtifacts artifacts: '*.log' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 206 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
| 207 | |
| 208 | } |
| 209 | } |
| 210 | } |
Joey Armstrong | 56fdfec | 2024-03-01 13:43:36 -0500 | [diff] [blame^] | 211 | |
| 212 | // [EOF] |