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 { |
| 22 | label "${params.executorNode}" |
| 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 | |
| 45 | stage('patch') { |
| 46 | steps { |
| 47 | sh """ |
| 48 | pushd cord |
| 49 | PROJECT_PATH=\$(xmllint --xpath "string(//project[@name=\\\"${gerritProject}\\\"]/@path)" .repo/manifest.xml) |
| 50 | repo download "\$PROJECT_PATH" "${gerritChangeNumber}/${gerritPatchsetNumber}" |
| 51 | popd |
| 52 | """ |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | |
| 57 | stage('minikube') { |
| 58 | steps { |
| 59 | /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */ |
| 60 | sh ''' |
| 61 | export MINIKUBE_WANTUPDATENOTIFICATION=false |
| 62 | export MINIKUBE_WANTREPORTERRORPROMPT=false |
| 63 | export CHANGE_MINIKUBE_NONE_USER=true |
| 64 | export MINIKUBE_HOME=$HOME |
| 65 | mkdir -p $HOME/.kube || true |
| 66 | touch $HOME/.kube/config |
| 67 | export KUBECONFIG=$HOME/.kube/config |
| 68 | sudo -E /usr/bin/minikube start --vm-driver=none |
| 69 | ''' |
| 70 | script { |
| 71 | timeout(3) { |
| 72 | waitUntil { |
| 73 | sleep 5 |
| 74 | def kc_ret = sh script: "kubectl get po", returnStatus: true |
| 75 | return (kc_ret == 0); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | stage('helm') { |
| 83 | steps { |
| 84 | sh ''' |
| 85 | helm init |
| 86 | sleep 60 |
| 87 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
| 88 | ''' |
| 89 | } |
| 90 | } |
| 91 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 92 | stage('install/test rcord-lite') { |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 93 | steps { |
| 94 | sh """ |
| 95 | #!/usr/bin/env bash |
| 96 | set -eu -o pipefail |
| 97 | |
| 98 | helm_install_args='-f examples/api-test-values.yaml' |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 99 | |
| 100 | pushd cord/helm-charts |
| 101 | |
| 102 | helm dep up xos-core |
| 103 | helm install \${helm_install_args} xos-core -n xos-core |
| 104 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 105 | helm dep update xos-profiles/rcord-lite |
| 106 | helm install \${helm_install_args} xos-profiles/rcord-lite -n rcord-lite |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 107 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 108 | # wait for services to load |
Kailash Khalasi | edb48b1 | 2018-07-31 13:01:01 -0700 | [diff] [blame] | 109 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
Kailash Khalasi | ba3e3d7 | 2018-08-03 13:53:45 -0700 | [diff] [blame] | 110 | # adding tmp sleep momentarily |
| 111 | sleep 120 |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 112 | |
| 113 | echo "# Checking helm deployments" |
| 114 | kubectl get pods |
| 115 | helm list |
| 116 | |
| 117 | for hchart in \$(helm list -q); |
| 118 | do |
| 119 | echo "## 'helm status' for chart: \${hchart} ##" |
| 120 | helm status "\${hchart}" |
| 121 | done |
| 122 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 123 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 124 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 125 | 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 |
| 126 | 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 |
| 127 | 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 |
| 128 | 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] | 129 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 130 | export testname=_service_api.robot |
| 131 | export library=_library.robot |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 132 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 133 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 134 | echo \$SERVICES |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 135 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 136 | 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] | 137 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 138 | 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] | 139 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 140 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 141 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 142 | 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] | 143 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 144 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 145 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 146 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 147 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 148 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 149 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 150 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 151 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 152 | ## Run CORE API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 153 | pybot -d Log -T XOSCoreAPITests.robot || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 154 | ## Run Rcord-lite services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 155 | for i in \$SERVICES; do bash -c "pybot -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] | 156 | |
| 157 | popd |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 158 | |
| 159 | helm delete --purge rcord-lite |
| 160 | helm delete --purge xos-core |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 161 | """ |
| 162 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 163 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 164 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 165 | stage('install/test mcord') { |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 166 | steps { |
| 167 | sh """ |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 168 | #!/usr/bin/env bash |
| 169 | set -eu -o pipefail |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 170 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 171 | helm_install_args='-f examples/api-test-values.yaml' |
| 172 | |
| 173 | pushd cord/helm-charts |
| 174 | |
| 175 | helm dep up xos-core |
| 176 | helm install \${helm_install_args} xos-core -n xos-core |
| 177 | |
| 178 | helm dep update xos-profiles/base-openstack |
| 179 | helm dep update xos-profiles/mcord |
| 180 | helm install \${helm_install_args} xos-profiles/base-openstack -n base-openstack |
| 181 | helm install \${helm_install_args} xos-profiles/mcord -n mcord |
| 182 | |
| 183 | # wait for services to load |
| 184 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
| 185 | |
| 186 | echo "# Checking helm deployments" |
| 187 | kubectl get pods |
| 188 | helm list |
| 189 | |
| 190 | for hchart in \$(helm list -q); |
| 191 | do |
| 192 | echo "## 'helm status' for chart: \${hchart} ##" |
| 193 | helm status "\${hchart}" |
| 194 | done |
| 195 | |
| 196 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 197 | |
| 198 | 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 |
| 199 | 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 |
| 200 | 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 |
| 201 | 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 |
| 202 | |
| 203 | export testname=_service_api.robot |
| 204 | export library=_library.robot |
| 205 | |
| 206 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 207 | echo \$SERVICES |
| 208 | |
| 209 | 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 |
| 210 | |
| 211 | 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 |
| 212 | |
| 213 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 214 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 215 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 216 | |
| 217 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 218 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 219 | |
| 220 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 221 | ## Run mcord services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 222 | for i in \$SERVICES; do bash -c "pybot -d Log -T -e ProgranServiceInstance -v TESTLIBRARY:\$i\$library \$i\$testname"; sleep 2; done || true |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 223 | |
| 224 | popd |
| 225 | |
| 226 | helm delete --purge base-openstack |
| 227 | helm delete --purge mcord |
| 228 | helm delete --purge xos-core |
| 229 | """ |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 233 | stage('install/test simpleexampleservice') { |
| 234 | steps { |
| 235 | sh """ |
| 236 | #!/usr/bin/env bash |
| 237 | set -eu -o pipefail |
| 238 | |
| 239 | helm_install_args='-f examples/api-test-values.yaml' |
| 240 | |
| 241 | pushd cord/helm-charts |
| 242 | |
| 243 | helm dep up xos-core |
| 244 | helm install \${helm_install_args} xos-core -n xos-core |
| 245 | |
| 246 | helm dep update xos-profiles/base-kubernetes |
| 247 | helm dep update xos-profiles/demo-simpleexampleservice |
| 248 | helm install \${helm_install_args} xos-profiles/base-kubernetes -n base-kubernetes |
| 249 | helm install \${helm_install_args} xos-profiles/demo-simpleexampleservice -n demo-simpleexampleservice |
| 250 | |
| 251 | # wait for services to load |
| 252 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
| 253 | |
| 254 | echo "# Checking helm deployments" |
| 255 | kubectl get pods |
| 256 | helm list |
| 257 | |
| 258 | for hchart in \$(helm list -q); |
| 259 | do |
| 260 | echo "## 'helm status' for chart: \${hchart} ##" |
| 261 | helm status "\${hchart}" |
| 262 | done |
| 263 | |
| 264 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 265 | |
| 266 | 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 |
| 267 | 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 |
| 268 | 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 |
| 269 | 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 |
| 270 | |
| 271 | export testname=_service_api.robot |
| 272 | export library=_library.robot |
| 273 | |
| 274 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 275 | echo \$SERVICES |
| 276 | |
| 277 | 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 |
| 278 | |
| 279 | 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 |
| 280 | |
| 281 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 282 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 283 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 284 | |
| 285 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 286 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 287 | |
| 288 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 289 | ## Run kubernetes-base services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 290 | for i in \$SERVICES; do bash -c "pybot -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] | 291 | |
| 292 | popd |
| 293 | |
| 294 | helm delete --purge base-kubernetes |
| 295 | helm delete --purge demo-simpleexampleservice |
| 296 | helm delete --purge xos-core |
| 297 | """ |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | stage('install/test hippie-oss') { |
| 302 | steps { |
| 303 | sh """ |
| 304 | #!/usr/bin/env bash |
| 305 | set -eu -o pipefail |
| 306 | |
| 307 | helm_install_args='-f examples/api-test-values.yaml' |
| 308 | |
| 309 | pushd cord/helm-charts |
| 310 | |
| 311 | helm dep up xos-core |
| 312 | helm install \${helm_install_args} xos-core -n xos-core |
| 313 | |
| 314 | helm dep update xos-services/hippie-oss |
| 315 | helm install \${helm_install_args} xos-services/hippie-oss -n hippie-oss |
| 316 | |
| 317 | # wait for services to load |
| 318 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
| 319 | ## sleeping as hippie-oss doesnt have a tosca-loader |
| 320 | sleep 300 |
| 321 | echo "# Checking helm deployments" |
| 322 | kubectl get pods |
| 323 | helm list |
| 324 | |
| 325 | for hchart in \$(helm list -q); |
| 326 | do |
| 327 | echo "## 'helm status' for chart: \${hchart} ##" |
| 328 | helm status "\${hchart}" |
| 329 | done |
| 330 | |
| 331 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 332 | |
| 333 | 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 |
| 334 | 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 |
| 335 | 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 |
| 336 | 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 |
| 337 | |
| 338 | export testname=_service_api.robot |
| 339 | export library=_library.robot |
| 340 | |
| 341 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 342 | echo \$SERVICES |
| 343 | |
| 344 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
| 345 | ## Run hippie-oss services API Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame] | 346 | for i in \$SERVICES; do bash -c "pybot -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] | 347 | |
| 348 | popd |
| 349 | |
| 350 | helm delete --purge hippie-oss |
| 351 | helm delete --purge xos-core |
| 352 | """ |
| 353 | } |
| 354 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 355 | } |
| 356 | post { |
| 357 | always { |
| 358 | sh ''' |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 359 | # copy robot logs |
| 360 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
| 361 | 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] | 362 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 363 | kubectl get pods --all-namespaces |
| 364 | |
| 365 | echo "# removing helm deployments" |
| 366 | kubectl get pods |
| 367 | helm list |
| 368 | |
| 369 | for hchart in \$(helm list -q); |
| 370 | do |
| 371 | echo "## Purging chart: \${hchart} ##" |
| 372 | helm delete --purge "\${hchart}" |
| 373 | done |
| 374 | |
Zack Williams | f8b356c | 2018-07-17 17:01:27 -0700 | [diff] [blame] | 375 | sudo minikube delete |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 376 | ''' |
Kailash Khalasi | 1c773ed | 2018-08-01 10:47:59 -0700 | [diff] [blame] | 377 | step([$class: 'RobotPublisher', |
| 378 | disableArchiveOutput: false, |
| 379 | logFileName: 'RobotLogs/log*.html', |
| 380 | otherFiles: '', |
| 381 | outputFileName: 'RobotLogs/output*.xml', |
| 382 | outputPath: '.', |
| 383 | passThreshold: 100, |
| 384 | reportFileName: 'RobotLogs/report*.html', |
| 385 | unstableThreshold: 0]); |
| 386 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "kailash@opennetworking.org", sendToIndividuals: false]) |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 387 | } |
| 388 | } |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 389 | } |