Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -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 | |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 18 | pipeline { |
| 19 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 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}" |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 23 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 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 | |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 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/ |
Carmelo Cascone | 0490a65 | 2020-01-17 13:42:40 -0800 | [diff] [blame] | 76 | helm repo add cord https://charts.opencord.org |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 77 | ''' |
| 78 | } |
| 79 | } |
| 80 | |
Zack Williams | a26fc9d | 2018-09-18 16:49:01 -0700 | [diff] [blame] | 81 | stage('cord-kafka') { |
| 82 | steps { |
| 83 | sh ''' |
| 84 | #!/usr/bin/env bash |
| 85 | set -eu -o pipefail |
| 86 | |
| 87 | pushd cord/helm-charts |
| 88 | 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] | 89 | |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 90 | ./helm-repo-tools/wait_for_pods.sh |
Zack Williams | a26fc9d | 2018-09-18 16:49:01 -0700 | [diff] [blame] | 91 | |
| 92 | popd |
| 93 | ''' |
| 94 | } |
| 95 | } |
| 96 | |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 97 | stage('install/test att-workflow') { |
Zack Williams | 2e515f3 | 2018-09-27 23:03:07 -0700 | [diff] [blame] | 98 | when { |
| 99 | expression { |
| 100 | params.manifestBranch ==~ 'master' |
| 101 | } |
| 102 | } |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 103 | steps { |
| 104 | sh """ |
| 105 | #!/usr/bin/env bash |
| 106 | set -eu -o pipefail |
| 107 | |
| 108 | helm_install_args='-f examples/api-test-values.yaml' |
| 109 | |
| 110 | pushd cord/helm-charts |
| 111 | |
| 112 | helm dep up xos-core |
| 113 | helm install \${helm_install_args} xos-core -n xos-core |
| 114 | |
Kailash | dddff08 | 2018-12-14 11:05:47 -0800 | [diff] [blame] | 115 | helm dep update xos-profiles/seba-services |
Kailash | 831b7ce | 2018-12-14 15:47:22 -0800 | [diff] [blame] | 116 | helm install \${helm_install_args} xos-profiles/seba-services -n seba-services |
Kailash | dddff08 | 2018-12-14 11:05:47 -0800 | [diff] [blame] | 117 | JOBS_TIMEOUT=900 ./helm-repo-tools/wait_for_jobs.sh |
Kailash Khalasi | 2832355 | 2018-12-13 15:03:22 -0800 | [diff] [blame] | 118 | helm dep update workflows/att-workflow |
| 119 | helm install \${helm_install_args} workflows/att-workflow -n att-workflow |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 120 | |
| 121 | # wait for services to load |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 122 | PODS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 123 | |
| 124 | echo "# Checking helm deployments" |
| 125 | kubectl get pods |
| 126 | |
| 127 | for hchart in \$(helm list -q); |
| 128 | do |
| 129 | echo "## 'helm status' for chart: \${hchart} ##" |
| 130 | helm status "\${hchart}" |
| 131 | done |
| 132 | |
Zack Williams | 2e515f3 | 2018-09-27 23:03:07 -0700 | [diff] [blame] | 133 | CORE_POD=\$(kubectl get pods | grep "xos-core.*Running" | awk '{print \$1}') |
| 134 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core_\${CORE_POD} | awk '{print \$1}') |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 135 | |
| 136 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 137 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 138 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 139 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
| 140 | |
| 141 | export testname=_service_api.robot |
| 142 | export library=_library.robot |
| 143 | |
| 144 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 145 | echo \$SERVICES |
| 146 | |
| 147 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
| 148 | |
| 149 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
| 150 | |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 151 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 152 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 153 | |
| 154 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 155 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 156 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 157 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 158 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 159 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 160 | |
Kailash | f7106c3 | 2018-12-12 10:08:20 -0800 | [diff] [blame] | 161 | timeout 300 bash -c "until http -a admin@opencord.org:letmein GET http://'\$XOS_CHAMELEON\':9101/xosapi/v1/core/sites |jq '.items[0].name'|grep -q mysite; do echo 'Waiting for API To be up'; sleep 10; done" |
| 162 | |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 163 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 164 | ## Run CORE API Tests |
Kailash | f14606e | 2018-12-06 14:11:11 -0800 | [diff] [blame] | 165 | robot -d Log -T XOSCoreAPITests.robot || true |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 166 | ## Run services API Tests |
Kailash | f14606e | 2018-12-06 14:11:11 -0800 | [diff] [blame] | 167 | for i in \$SERVICES; do bash -c "robot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 168 | |
| 169 | popd |
| 170 | |
| 171 | helm delete --purge att-workflow |
| 172 | helm delete --purge xos-core |
Kailash | 831b7ce | 2018-12-14 15:47:22 -0800 | [diff] [blame] | 173 | helm delete --purge seba-services |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 174 | """ |
| 175 | } |
| 176 | } |
| 177 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 178 | stage('install/test rcord-lite') { |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 179 | steps { |
| 180 | sh """ |
| 181 | #!/usr/bin/env bash |
| 182 | set -eu -o pipefail |
| 183 | |
| 184 | helm_install_args='-f examples/api-test-values.yaml' |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 185 | |
| 186 | pushd cord/helm-charts |
| 187 | |
| 188 | helm dep up xos-core |
| 189 | helm install \${helm_install_args} xos-core -n xos-core |
| 190 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 191 | helm dep update xos-profiles/rcord-lite |
| 192 | helm install \${helm_install_args} xos-profiles/rcord-lite -n rcord-lite |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 193 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 194 | # wait for services to load |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 195 | PODS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 196 | |
| 197 | echo "# Checking helm deployments" |
| 198 | kubectl get pods |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 199 | |
| 200 | for hchart in \$(helm list -q); |
| 201 | do |
| 202 | echo "## 'helm status' for chart: \${hchart} ##" |
| 203 | helm status "\${hchart}" |
| 204 | done |
| 205 | |
Zack Williams | 2e515f3 | 2018-09-27 23:03:07 -0700 | [diff] [blame] | 206 | CORE_POD=\$(kubectl get pods | grep "xos-core.*Running" | awk '{print \$1}') |
| 207 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core_\${CORE_POD} | awk '{print \$1}') |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 208 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 209 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 210 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 211 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 212 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 213 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 214 | export testname=_service_api.robot |
| 215 | export library=_library.robot |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 216 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 217 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 218 | echo \$SERVICES |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 219 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 220 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 221 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 222 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 223 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 224 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 225 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 226 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 227 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 228 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 229 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 230 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 231 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 232 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
Kailash | f7106c3 | 2018-12-12 10:08:20 -0800 | [diff] [blame] | 233 | timeout 300 bash -c "until http -a admin@opencord.org:letmein GET http://'\$XOS_CHAMELEON\':9101/xosapi/v1/core/sites |jq '.items[0].name'|grep -q mysite; do echo 'Waiting for API To be up'; sleep 10; done" |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 234 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 235 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 236 | ## Run CORE API Tests |
Kailash | f14606e | 2018-12-06 14:11:11 -0800 | [diff] [blame] | 237 | robot -d Log -T XOSCoreAPITests.robot || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 238 | ## Run Rcord-lite services API Tests |
Kailash | f14606e | 2018-12-06 14:11:11 -0800 | [diff] [blame] | 239 | for i in \$SERVICES; do bash -c "robot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 240 | |
| 241 | popd |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 242 | |
| 243 | helm delete --purge rcord-lite |
| 244 | helm delete --purge xos-core |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 245 | """ |
| 246 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 247 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 248 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 249 | stage('install/test simpleexampleservice') { |
| 250 | steps { |
| 251 | sh """ |
| 252 | #!/usr/bin/env bash |
| 253 | set -eu -o pipefail |
| 254 | |
| 255 | helm_install_args='-f examples/api-test-values.yaml' |
| 256 | |
| 257 | pushd cord/helm-charts |
| 258 | |
| 259 | helm dep up xos-core |
| 260 | helm install \${helm_install_args} xos-core -n xos-core |
| 261 | |
| 262 | helm dep update xos-profiles/base-kubernetes |
| 263 | helm dep update xos-profiles/demo-simpleexampleservice |
| 264 | helm install \${helm_install_args} xos-profiles/base-kubernetes -n base-kubernetes |
| 265 | helm install \${helm_install_args} xos-profiles/demo-simpleexampleservice -n demo-simpleexampleservice |
| 266 | |
| 267 | # wait for services to load |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 268 | PODS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 269 | |
| 270 | echo "# Checking helm deployments" |
| 271 | kubectl get pods |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 272 | |
| 273 | for hchart in \$(helm list -q); |
| 274 | do |
| 275 | echo "## 'helm status' for chart: \${hchart} ##" |
| 276 | helm status "\${hchart}" |
| 277 | done |
| 278 | |
Zack Williams | 2e515f3 | 2018-09-27 23:03:07 -0700 | [diff] [blame] | 279 | CORE_POD=\$(kubectl get pods | grep "xos-core.*Running" | awk '{print \$1}') |
| 280 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core_\${CORE_POD} | awk '{print \$1}') |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 281 | |
| 282 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 283 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 284 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 285 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
| 286 | |
| 287 | export testname=_service_api.robot |
| 288 | export library=_library.robot |
| 289 | |
| 290 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 291 | echo \$SERVICES |
| 292 | |
| 293 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
| 294 | |
| 295 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
| 296 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 297 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 298 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 299 | |
| 300 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 301 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
Kailash | f7106c3 | 2018-12-12 10:08:20 -0800 | [diff] [blame] | 302 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 303 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 304 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 305 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 306 | timeout 300 bash -c "until http -a admin@opencord.org:letmein GET http://'\$XOS_CHAMELEON\':9101/xosapi/v1/core/sites |jq '.items[0].name'|grep -q mysite; do echo 'Waiting for API To be up'; sleep 10; done" |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 307 | |
Kailash | e2a3bfb | 2018-12-12 14:12:15 -0800 | [diff] [blame] | 308 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 309 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 310 | ## Run kubernetes-base services API Tests |
Kailash | f14606e | 2018-12-06 14:11:11 -0800 | [diff] [blame] | 311 | for i in \$SERVICES; do bash -c "robot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 312 | |
| 313 | popd |
| 314 | |
| 315 | helm delete --purge base-kubernetes |
| 316 | helm delete --purge demo-simpleexampleservice |
| 317 | helm delete --purge xos-core |
| 318 | """ |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | stage('install/test hippie-oss') { |
| 323 | steps { |
| 324 | sh """ |
| 325 | #!/usr/bin/env bash |
| 326 | set -eu -o pipefail |
| 327 | |
| 328 | helm_install_args='-f examples/api-test-values.yaml' |
| 329 | |
| 330 | pushd cord/helm-charts |
| 331 | |
| 332 | helm dep up xos-core |
| 333 | helm install \${helm_install_args} xos-core -n xos-core |
| 334 | |
| 335 | helm dep update xos-services/hippie-oss |
| 336 | helm install \${helm_install_args} xos-services/hippie-oss -n hippie-oss |
Kailash Khalasi | 4859b3d | 2018-12-15 20:09:16 -0800 | [diff] [blame] | 337 | sleep 300 |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 338 | |
| 339 | # wait for services to load |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 340 | PODS_TIMEOUT=900 ./helm-repo-tools/wait_for_pods.sh |
Zack Williams | 91cecd2 | 2018-09-26 10:59:44 -0700 | [diff] [blame] | 341 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 342 | echo "# Checking helm deployments" |
| 343 | kubectl get pods |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 344 | |
| 345 | for hchart in \$(helm list -q); |
| 346 | do |
| 347 | echo "## 'helm status' for chart: \${hchart} ##" |
| 348 | helm status "\${hchart}" |
| 349 | done |
| 350 | |
Zack Williams | 2e515f3 | 2018-09-27 23:03:07 -0700 | [diff] [blame] | 351 | CORE_POD=\$(kubectl get pods | grep "xos-core.*Running" | awk '{print \$1}') |
| 352 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core_\${CORE_POD} | awk '{print \$1}') |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 353 | |
| 354 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosapitests.xtarget |
| 355 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xosserviceapitests.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xosserviceapitests.xtarget |
| 356 | docker cp $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/targets/xoslibrary.xtarget \$CORE_CONTAINER:/opt/xos/lib/xos-genx/xosgenx/targets/xoslibrary.xtarget |
| 357 | docker exec -i \$CORE_CONTAINER /bin/bash -c "xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosapitests.xtarget /opt/xos/core/models/core.xproto" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/XOSCoreAPITests.robot |
| 358 | |
| 359 | export testname=_service_api.robot |
| 360 | export library=_library.robot |
| 361 | |
| 362 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 363 | echo \$SERVICES |
| 364 | |
Kailash | e2a3bfb | 2018-12-12 14:12:15 -0800 | [diff] [blame] | 365 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xosserviceapitests.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$testname; done |
| 366 | |
| 367 | for i in \$SERVICES; do bash -c "docker exec -i \$CORE_CONTAINER /bin/bash -c 'xosgenx --target /opt/xos/lib/xos-genx/xosgenx/targets/./xoslibrary.xtarget /opt/xos/dynamic_services/\$i/\$i.xproto /opt/xos/core/models/core.xproto'" > $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/\$i\$library; done |
| 368 | |
| 369 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 370 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 371 | |
Kailash | f7106c3 | 2018-12-12 10:08:20 -0800 | [diff] [blame] | 372 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 373 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 374 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 375 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 376 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 377 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 378 | timeout 300 bash -c "until http -a admin@opencord.org:letmein GET http://'\$XOS_CHAMELEON\':9101/xosapi/v1/core/sites |jq '.items[0].name'|grep -q mysite; do echo 'Waiting for API To be up'; sleep 10; done" |
| 379 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 380 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 381 | ## Run hippie-oss services API Tests |
Kailash | f14606e | 2018-12-06 14:11:11 -0800 | [diff] [blame] | 382 | for i in \$SERVICES; do bash -c "robot -d Log -T -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 383 | |
| 384 | popd |
| 385 | |
| 386 | helm delete --purge hippie-oss |
| 387 | helm delete --purge xos-core |
| 388 | """ |
| 389 | } |
| 390 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 391 | } |
| 392 | post { |
| 393 | always { |
| 394 | sh ''' |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 395 | # copy robot logs |
| 396 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
| 397 | cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/Log/*ml ./RobotLogs |
Kailash Khalasi | ecb4eb6 | 2018-07-31 15:20:19 -0700 | [diff] [blame] | 398 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 399 | kubectl get pods --all-namespaces |
| 400 | |
| 401 | echo "# removing helm deployments" |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 402 | for hchart in \$(helm list -q); |
| 403 | do |
| 404 | echo "## Purging chart: \${hchart} ##" |
| 405 | helm delete --purge "\${hchart}" |
| 406 | done |
| 407 | |
Zack Williams | f8b356c | 2018-07-17 17:01:27 -0700 | [diff] [blame] | 408 | sudo minikube delete |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 409 | ''' |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 410 | step([$class: 'RobotPublisher', |
| 411 | disableArchiveOutput: false, |
| 412 | logFileName: 'RobotLogs/log*.html', |
| 413 | otherFiles: '', |
| 414 | outputFileName: 'RobotLogs/output*.xml', |
| 415 | outputPath: '.', |
| 416 | passThreshold: 100, |
| 417 | reportFileName: 'RobotLogs/report*.html', |
| 418 | unstableThreshold: 0]); |
| 419 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 420 | } |
| 421 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 422 | } |