Joey Armstrong | 6a9013e | 2024-02-01 17:56:57 -0500 | [diff] [blame^] | 1 | // Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 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 | |
| 18 | pipeline { |
| 19 | |
| 20 | /* no label, executor is determined by JJB */ |
| 21 | agent { |
Zack Williams | b329208 | 2019-10-11 17:15:18 -0700 | [diff] [blame] | 22 | label "${params.buildNode}" |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | stages { |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 26 | 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 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 38 | 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 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 56 | stage('Build BBSIM') { |
| 57 | steps { |
| 58 | sh ''' |
| 59 | git clone https://github.com/opencord/voltha-bbsim |
| 60 | cd voltha-bbsim/ |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 61 | docker images | grep bbsim |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 62 | ''' |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | stage('Install BBSIM w/SEBA') { |
| 67 | steps { |
| 68 | sh """ |
| 69 | #!/usr/bin/env bash |
| 70 | set -eu -o pipefail |
| 71 | |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 72 | git clone https://gerrit.opencord.org/pod-configs |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 73 | pushd cord/helm-charts |
| 74 | |
| 75 | helm install -f examples/kafka-single.yaml --version 0.13.3 -n cord-kafka incubator/kafka |
| 76 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 77 | helm-repo-tools/wait_for_pods.sh |
| 78 | |
| 79 | helm upgrade --install etcd-operator --version 0.8.3 stable/etcd-operator |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 80 | sleep 60 |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 81 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
| 82 | |
| 83 | helm dep up voltha |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 84 | 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 |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 90 | |
| 91 | helm dep up xos-core |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 92 | 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] | 93 | |
| 94 | helm dep update xos-profiles/seba-services |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 95 | 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] | 96 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
| 97 | |
Kailash | 0db702b | 2019-01-29 13:54:19 -0800 | [diff] [blame] | 98 | helm dep update xos-profiles/base-kubernetes |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 99 | 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] | 100 | |
| 101 | helm dep update workflows/att-workflow |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 102 | 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] | 103 | |
| 104 | # wait for services to load |
| 105 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 106 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 107 | echo "# Checking helm deployments" |
| 108 | kubectl get pods |
| 109 | helm list |
| 110 | |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 111 | 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] | 112 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 113 | 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 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 122 | 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 |
Kailash | af893c7 | 2019-06-26 14:36:55 -0700 | [diff] [blame] | 129 | 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] | 130 | popd |
| 131 | ''' |
| 132 | } |
| 133 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 134 | stage('Test BBSIM') { |
| 135 | steps { |
Kailash | ef0be3d | 2019-03-19 09:21:22 -0700 | [diff] [blame] | 136 | sh """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 137 | #!/usr/bin/env bash |
| 138 | set -eu -o pipefail |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 139 | pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 140 | 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] | 141 | """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 142 | } |
| 143 | } |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 144 | 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 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 154 | |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 155 | stage ('Archive Artifacts') { |
Kailash | aad0e71 | 2019-03-22 20:42:07 -0700 | [diff] [blame] | 156 | when { expression { return params.ArchiveLogs } } |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 157 | 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 | } |
Kailash | aad0e71 | 2019-03-22 20:42:07 -0700 | [diff] [blame] | 177 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 178 | post { |
| 179 | always { |
| 180 | sh ''' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 181 | # copy robot logs |
| 182 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Kailash | f2688e0 | 2019-03-18 21:11:13 -0700 | [diff] [blame] | 183 | 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] | 184 | |
| 185 | echo "# removing helm deployments" |
| 186 | kubectl get pods |
| 187 | helm list |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 188 | ''' |
| 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]); |
Kailash | 2c1900c | 2019-02-11 12:18:27 -0800 | [diff] [blame] | 198 | archiveArtifacts artifacts: '*.log' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 199 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
| 200 | |
| 201 | } |
| 202 | } |
| 203 | } |
Joey Armstrong | 6a9013e | 2024-02-01 17:56:57 -0500 | [diff] [blame^] | 204 | |
| 205 | // [EOF] |