Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [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 | pod_config = null |
| 16 | |
| 17 | node ("${TestNodeName}") { |
| 18 | timeout (time: 240) { |
| 19 | stage ("Parse deployment configuration file") { |
| 20 | sh returnStdout: true, script: 'rm -rf ${configRepoBaseDir}' |
| 21 | sh returnStdout: true, script: 'git clone -b ${branch} ${configRepoUrl}' |
| 22 | deployment_config = readYaml file: "${configRepoBaseDir}${configRepoFile}" |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 23 | } |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 24 | |
| 25 | stage('Export pod config') { |
| 26 | timeout(10) { |
| 27 | try { |
| 28 | sh """ |
| 29 | cd /home/cord |
| 30 | rm -rf /home/cord/helm-charts |
| 31 | git clone -b ${branch} https://gerrit.opencord.org/helm-charts |
| 32 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
| 33 | kubectl get pods |
| 34 | """ |
| 35 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 36 | } |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 37 | } |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 38 | stage('Clean up') { |
| 39 | timeout(10) { |
| 40 | try { |
| 41 | sh """ |
| 42 | cd /home/cord/helm-charts |
| 43 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
| 44 | helm ls | grep onos-voltha && helm delete --purge onos-voltha |
| 45 | helm ls | grep onos-fabric && helm delete --purge onos-fabric |
| 46 | helm ls | grep voltha && helm delete --purge voltha |
| 47 | helm ls | grep rcord-lite && helm delete --purge rcord-lite |
| 48 | helm ls | grep xos-core && helm delete --purge xos-core |
Suchitra Vemuri | 9c4ffec | 2018-06-08 17:27:47 -0700 | [diff] [blame] | 49 | sleep 80 |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 50 | """ |
| 51 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 52 | } |
| 53 | } |
| 54 | stage('Install xos-core and rcord-lite') { |
| 55 | timeout(10) { |
| 56 | try { |
| 57 | sh """ |
| 58 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
| 59 | cd /home/cord/helm-charts |
| 60 | helm dep update xos-core |
| 61 | helm install -n xos-core xos-core |
| 62 | helm dep update xos-profiles/rcord-lite |
| 63 | helm install -n rcord-lite xos-profiles/rcord-lite |
| 64 | """ |
| 65 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 66 | } |
| 67 | } |
| 68 | stage('Install voltha') { |
| 69 | timeout(10) { |
| 70 | try { |
| 71 | sh """ |
| 72 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
| 73 | cd /home/cord/helm-charts/voltha |
| 74 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
| 75 | helm dep build |
| 76 | cd /home/cord/helm-charts |
| 77 | helm install -n voltha --set etcd-operator.customResources.createEtcdClusterCRD=false voltha |
| 78 | helm upgrade --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ./voltha |
| 79 | """ |
| 80 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 81 | } |
| 82 | } |
| 83 | stage('Install ONOS-Voltha and ONOS-Fabric') { |
| 84 | timeout(10) { |
| 85 | try { |
| 86 | sh """ |
| 87 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
| 88 | cd /home/cord/helm-charts |
| 89 | helm install -n onos-fabric -f configs/onos-fabric.yaml onos |
| 90 | helm install -n onos-voltha -f configs/onos-voltha.yaml onos |
Suchitra Vemuri | 9c4ffec | 2018-06-08 17:27:47 -0700 | [diff] [blame] | 91 | sleep 60 |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 92 | """ |
| 93 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 94 | } |
| 95 | } |
| 96 | stage('Download cord-tester repo') { |
| 97 | timeout(10) { |
| 98 | try { |
| 99 | sh """ |
| 100 | rm -rf /home/cord/cord-tester |
| 101 | cd /home/cord/ |
| 102 | git clone -b ${branch} https://gerrit.opencord.org/cord-tester |
| 103 | """ |
| 104 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 105 | } |
| 106 | } |
Suchitra Vemuri | 9c4ffec | 2018-06-08 17:27:47 -0700 | [diff] [blame] | 107 | stage('Validate Helm Chart Install') { |
| 108 | timeout(10) { |
| 109 | try { |
| 110 | sh """ |
| 111 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
| 112 | cd /home/cord/cord-tester/src/test/robot/ |
| 113 | rm -rf Log/ || true |
Kailash Khalasi | e9ad83c | 2018-08-07 11:22:36 -0700 | [diff] [blame] | 114 | pybot -d Log -T SanityK8POD.robot || true |
Suchitra Vemuri | 9c4ffec | 2018-06-08 17:27:47 -0700 | [diff] [blame] | 115 | """ |
| 116 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 117 | } |
| 118 | } |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 119 | stage('Verify E2E XOS') { |
| 120 | timeout(10) { |
| 121 | try { |
| 122 | sh """ |
| 123 | export KUBECONFIG=/home/cord/${deployment_config.pod_config} |
Suchitra Vemuri | 94760d1 | 2018-06-11 15:03:56 -0700 | [diff] [blame] | 124 | chameleon=\$(kubectl get pods | grep chameleon | cut -d' ' -f1) |
| 125 | echo \$chameleon |
| 126 | kubectl delete pod \$chameleon |
| 127 | sleep 120 |
Suchitra Vemuri | 9c4ffec | 2018-06-08 17:27:47 -0700 | [diff] [blame] | 128 | kubectl get pods |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 129 | cd /home/cord/cord-tester/src/test/cord-api/Properties/ |
| 130 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.node1.ip}\'/\" RestApiProperties.py |
| 131 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py |
| 132 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 133 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 134 | cd /home/cord/cord-tester/src/test/cord-api/Tests |
| 135 | rm -rf Log/ || true |
Kailash Khalasi | e9ad83c | 2018-08-07 11:22:36 -0700 | [diff] [blame] | 136 | pybot -d Log -T VOLTDevice_Test.txt || true |
| 137 | pybot -d Log -T RCORDLite_E2ETest.txt || true |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 138 | """ |
| 139 | } catch(error) { currentBuild.result = 'FAILURE' } |
| 140 | } |
| 141 | } |
| 142 | stage('Publish') { |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 143 | try { |
| 144 | sh """ |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 145 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs; |
| 146 | mkdir RobotLogs/TestDoc || true |
Suchitra Vemuri | 9c4ffec | 2018-06-08 17:27:47 -0700 | [diff] [blame] | 147 | cp -r /home/cord/cord-tester/src/test/robot/Log/* ./RobotLogs || true |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 148 | cp -r /home/cord/cord-tester/src/test/cord-api/Tests/Log/* ./RobotLogs || true |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 149 | """ |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 150 | step([$class: 'RobotPublisher', |
| 151 | disableArchiveOutput: false, |
| 152 | logFileName: 'RobotLogs/log*.html', |
| 153 | otherFiles: '', |
| 154 | outputFileName: 'RobotLogs/output*.xml', |
| 155 | outputPath: '.', |
| 156 | passThreshold: 100, |
| 157 | reportFileName: 'RobotLogs/report*.html', |
| 158 | unstableThreshold: 0]) |
| 159 | } catch(error) {} |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 160 | } |
Suchitra Vemuri | 2c1896a | 2018-06-04 23:43:16 -0700 | [diff] [blame] | 161 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 162 | } |
Suchitra Vemuri | c365ebe | 2018-06-01 00:04:16 -0700 | [diff] [blame] | 163 | } |