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 { |
| 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 | |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 45 | stage('Clean up') { |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 46 | steps { |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 47 | 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 | """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
| 60 | stage('Build BBSIM') { |
| 61 | steps { |
| 62 | sh ''' |
| 63 | git clone https://github.com/opencord/voltha-bbsim |
| 64 | cd voltha-bbsim/ |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 65 | docker images | grep bbsim |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 66 | ''' |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | stage('Install BBSIM w/SEBA') { |
| 71 | steps { |
| 72 | sh """ |
| 73 | #!/usr/bin/env bash |
| 74 | set -eu -o pipefail |
| 75 | |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 76 | git clone https://gerrit.opencord.org/pod-configs |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 77 | 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 |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 85 | sleep 60 |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 86 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
| 87 | |
| 88 | helm dep up voltha |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 89 | 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 |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 95 | |
| 96 | helm dep up xos-core |
Kailash | 0db702b | 2019-01-29 13:54:19 -0800 | [diff] [blame] | 97 | helm install xos-core -n xos-core |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 98 | |
| 99 | helm dep update xos-profiles/seba-services |
Kailash | 0db702b | 2019-01-29 13:54:19 -0800 | [diff] [blame] | 100 | helm install xos-profiles/seba-services -n seba-services |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 101 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
| 102 | |
Kailash | 0db702b | 2019-01-29 13:54:19 -0800 | [diff] [blame] | 103 | helm dep update xos-profiles/base-kubernetes |
| 104 | helm install xos-profiles/base-kubernetes -n base-kubernetes |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 105 | |
| 106 | helm dep update workflows/att-workflow |
Kailash | 0db702b | 2019-01-29 13:54:19 -0800 | [diff] [blame] | 107 | helm install workflows/att-workflow -n att-workflow --set att-workflow-driver.kafkaService=cord-kafka |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 108 | |
| 109 | # wait for services to load |
| 110 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
Kailash | ff5c540 | 2019-01-28 15:47:54 -0800 | [diff] [blame] | 111 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 112 | echo "# Checking helm deployments" |
| 113 | kubectl get pods |
| 114 | helm list |
| 115 | |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 116 | 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 | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 117 | 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 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 126 | 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 | } |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 137 | stage('Test BBSIM') { |
| 138 | steps { |
Kailash | ef0be3d | 2019-03-19 09:21:22 -0700 | [diff] [blame] | 139 | sh """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 140 | #!/usr/bin/env bash |
| 141 | set -eu -o pipefail |
Kailash | e4ac286 | 2019-03-21 12:03:40 -0700 | [diff] [blame] | 142 | pushd cord/test/cord-tester/src/test/cord-api/Tests/BBSim |
Kailash | f137544 | 2019-03-21 18:02:58 -0700 | [diff] [blame] | 143 | robot -e serviceinstances -e onosdhcp -e notready -v number_of_onus:${params.OnuCount} -v timeout:${params.TestTimeout} BBSIMScale.robot || true |
Kailash | ef0be3d | 2019-03-19 09:21:22 -0700 | [diff] [blame] | 144 | """ |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 145 | } |
| 146 | } |
| 147 | } |
Kailash | d029488 | 2019-03-19 13:23:32 -0700 | [diff] [blame] | 148 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 149 | post { |
| 150 | always { |
| 151 | sh ''' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 152 | kubectl get pods --all-namespaces |
Kailash | c06c9b6 | 2019-02-25 10:01:24 -0800 | [diff] [blame] | 153 | ## get default pod logs |
Kailash | 2c1900c | 2019-02-11 12:18:27 -0800 | [diff] [blame] | 154 | 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 |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 162 | |
Kailash | c06c9b6 | 2019-02-25 10:01:24 -0800 | [diff] [blame] | 163 | ## 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 | |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 173 | # copy robot logs |
| 174 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Kailash | f2688e0 | 2019-03-18 21:11:13 -0700 | [diff] [blame] | 175 | 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] | 176 | |
| 177 | echo "# removing helm deployments" |
| 178 | kubectl get pods |
| 179 | helm list |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 180 | ''' |
| 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]); |
Kailash | 2c1900c | 2019-02-11 12:18:27 -0800 | [diff] [blame] | 190 | archiveArtifacts artifacts: '*.log' |
Kailash | 46a2a9a | 2019-01-23 12:39:04 -0800 | [diff] [blame] | 191 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
| 192 | |
| 193 | } |
| 194 | } |
| 195 | } |