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