Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -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 | // 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}", \ |
Kailash Khalasi | f55eba8 | 2018-08-21 13:02:38 -0700 | [diff] [blame] | 33 | manifestBranch: "${params.manifestBranch}", \ |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 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 | |
| 45 | stage('minikube') { |
| 46 | steps { |
| 47 | /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */ |
| 48 | sh ''' |
| 49 | export MINIKUBE_WANTUPDATENOTIFICATION=false |
| 50 | export MINIKUBE_WANTREPORTERRORPROMPT=false |
| 51 | export CHANGE_MINIKUBE_NONE_USER=true |
| 52 | export MINIKUBE_HOME=$HOME |
| 53 | mkdir -p $HOME/.kube || true |
| 54 | touch $HOME/.kube/config |
| 55 | export KUBECONFIG=$HOME/.kube/config |
| 56 | sudo -E /usr/bin/minikube start --vm-driver=none |
| 57 | ''' |
| 58 | script { |
| 59 | timeout(3) { |
| 60 | waitUntil { |
| 61 | sleep 5 |
| 62 | def kc_ret = sh script: "kubectl get po", returnStatus: true |
| 63 | return (kc_ret == 0); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | stage('helm') { |
| 71 | steps { |
| 72 | sh ''' |
| 73 | helm init |
| 74 | sleep 60 |
| 75 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
| 76 | ''' |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | |
Kailash | d3a29cc | 2019-02-05 09:26:10 -0800 | [diff] [blame] | 81 | stage('install profile') { |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 82 | steps { |
| 83 | sh """ |
| 84 | #!/usr/bin/env bash |
| 85 | set -eu -o pipefail |
| 86 | |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 87 | pushd cord/helm-charts |
| 88 | |
Zack Williams | a26fc9d | 2018-09-18 16:49:01 -0700 | [diff] [blame] | 89 | helm install -f examples/kafka-single.yaml --version 0.8.8 -n cord-kafka incubator/kafka |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 90 | |
| 91 | git clone https://gerrit.opencord.org/helm-repo-tools |
| 92 | helm-repo-tools/wait_for_pods.sh |
Zack Williams | a26fc9d | 2018-09-18 16:49:01 -0700 | [diff] [blame] | 93 | |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 94 | helm dep up xos-core |
| 95 | helm install xos-core -n xos-core |
| 96 | |
Kailash | f05f3a1 | 2018-12-17 09:06:28 -0800 | [diff] [blame] | 97 | helm dep update xos-profiles/seba-services |
Kailash | be13fe7 | 2019-02-04 10:50:48 -0800 | [diff] [blame] | 98 | helm install xos-profiles/seba-services |
Kailash | f05f3a1 | 2018-12-17 09:06:28 -0800 | [diff] [blame] | 99 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
| 100 | helm dep update workflows/att-workflow |
Kailash | 8fb3b69 | 2019-02-06 12:07:36 -0800 | [diff] [blame] | 101 | helm install workflows/att-workflow --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow |
Kailash | f05f3a1 | 2018-12-17 09:06:28 -0800 | [diff] [blame] | 102 | |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 103 | helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 104 | |
| 105 | # wait for services to load |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 106 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 107 | sleep 300 |
| 108 | echo "# Checking helm deployments" |
| 109 | kubectl get pods |
| 110 | helm list |
| 111 | |
| 112 | for hchart in \$(helm list -q); |
| 113 | do |
| 114 | echo "## 'helm status' for chart: \${hchart} ##" |
| 115 | helm status "\${hchart}" |
| 116 | done |
Kailash | be13fe7 | 2019-02-04 10:50:48 -0800 | [diff] [blame] | 117 | popd |
| 118 | |
| 119 | """ |
| 120 | } |
| 121 | } |
| 122 | stage('test data-model scale') { |
| 123 | steps { |
| 124 | sh """ |
| 125 | #!/usr/bin/env bash |
| 126 | set -eu -o pipefail |
Kailash | d3a29cc | 2019-02-05 09:26:10 -0800 | [diff] [blame] | 127 | CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
Kailash | be13fe7 | 2019-02-04 10:50:48 -0800 | [diff] [blame] | 128 | pushd cord/test/cord-tester/src/test/cord-api/ |
| 129 | source setup_venv.sh |
Kailash | d3a29cc | 2019-02-05 09:26:10 -0800 | [diff] [blame] | 130 | cd Tests/XosScaleValidations |
Kailash | be13fe7 | 2019-02-04 10:50:48 -0800 | [diff] [blame] | 131 | robot --variable xos_chameleon_url:127.0.0.1 \ |
| 132 | --variable xos_chameleon_port:30006 \ |
| 133 | --variable cord_kafka:\$CORD_KAFKA_IP \ |
Kailash | 2a8fe66 | 2019-02-07 09:58:28 -0800 | [diff] [blame] | 134 | --variable num_olts:${params.Olts} \ |
| 135 | --variable num_onus:${params.Onus} \ |
| 136 | --variable num_pon_ports:${params.PonPorts} \ |
Kailash | 8fb3b69 | 2019-02-06 12:07:36 -0800 | [diff] [blame] | 137 | xos-scale-att-workflow.robot || true |
Kailash | be13fe7 | 2019-02-04 10:50:48 -0800 | [diff] [blame] | 138 | popd |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 139 | |
| 140 | """ |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | post { |
| 145 | always { |
| 146 | sh ''' |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 147 | kubectl get pods --all-namespaces |
| 148 | |
| 149 | # copy robot logs |
| 150 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Kailash | d3a29cc | 2019-02-05 09:26:10 -0800 | [diff] [blame] | 151 | cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XosScaleValidations/*ml ./RobotLogs |
Kailash Khalasi | c00ac4d | 2018-08-20 09:21:48 -0700 | [diff] [blame] | 152 | echo "# removing helm deployments" |
| 153 | kubectl get pods |
| 154 | helm list |
| 155 | |
| 156 | for hchart in \$(helm list -q); |
| 157 | do |
| 158 | echo "## Purging chart: \${hchart} ##" |
| 159 | helm delete --purge "\${hchart}" |
| 160 | done |
| 161 | |
| 162 | sudo minikube delete |
| 163 | ''' |
| 164 | step([$class: 'RobotPublisher', |
| 165 | disableArchiveOutput: false, |
| 166 | logFileName: 'RobotLogs/log*.html', |
| 167 | otherFiles: '', |
| 168 | outputFileName: 'RobotLogs/output*.xml', |
| 169 | outputPath: '.', |
| 170 | passThreshold: 100, |
| 171 | reportFileName: 'RobotLogs/report*.html', |
| 172 | unstableThreshold: 0]); |
| 173 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org, teo@opennetworking.org", sendToIndividuals: false]) |
| 174 | |
| 175 | } |
| 176 | } |
| 177 | } |