Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 1 | // 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 | |
| 18 | pipeline { |
| 19 | |
| 20 | /* no label, executor is determined by JJB */ |
| 21 | agent { |
| 22 | label "${params.executorNode}" |
| 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 |
| 129 | popd |
| 130 | ''' |
| 131 | } |
| 132 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 133 | stage('Test BBSIM') { |
| 134 | steps { |
Kailash | ef0be3d | 2019-03-19 09:21:22 -0700 | [diff] [blame] | 135 | sh """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 136 | #!/usr/bin/env bash |
| 137 | set -eu -o pipefail |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 138 | pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 139 | 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] | 140 | """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 141 | } |
| 142 | } |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 143 | 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 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 153 | |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 154 | stage ('Archive Artifacts') { |
Kailash | aad0e71 | 2019-03-22 20:42:07 -0700 | [diff] [blame] | 155 | when { expression { return params.ArchiveLogs } } |
Kailash | 595a27e | 2019-03-22 19:53:14 -0700 | [diff] [blame] | 156 | 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 | } |
Kailash | aad0e71 | 2019-03-22 20:42:07 -0700 | [diff] [blame] | 176 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 177 | post { |
| 178 | always { |
| 179 | sh ''' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 180 | # copy robot logs |
| 181 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Kailash | f2688e0 | 2019-03-18 21:11:13 -0700 | [diff] [blame] | 182 | 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] | 183 | |
| 184 | echo "# removing helm deployments" |
| 185 | kubectl get pods |
| 186 | helm list |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 187 | ''' |
| 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]); |
Kailash | 2c1900c | 2019-02-11 12:18:27 -0800 | [diff] [blame] | 197 | archiveArtifacts artifacts: '*.log' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 198 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
| 199 | |
| 200 | } |
| 201 | } |
| 202 | } |