Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -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 | |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 15 | // Run XOS api tests on HEAD of a branch (usually master), loading the |
| 16 | // corresponding charts |
| 17 | |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 18 | CORE_CONTAINER="null" |
| 19 | |
| 20 | pipeline { |
| 21 | |
| 22 | /* no label, executor is determined by JJB */ |
| 23 | agent { |
| 24 | label "${params.executorNode}" |
| 25 | } |
| 26 | |
| 27 | stages { |
| 28 | |
| 29 | stage('repo') { |
| 30 | steps { |
| 31 | checkout(changelog: false, \ |
| 32 | poll: false, |
| 33 | scm: [$class: 'RepoScm', \ |
| 34 | manifestRepositoryUrl: "${params.manifestUrl}", \ |
| 35 | manifestBranch: "${params.manifestBranch}", \ |
| 36 | currentBranch: true, \ |
| 37 | destinationDir: 'cord', \ |
| 38 | forceSync: true, |
| 39 | resetFirst: true, \ |
| 40 | quiet: true, \ |
| 41 | jobs: 4, \ |
| 42 | showAllChanges: true] \ |
| 43 | ) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | stage('patch') { |
| 48 | steps { |
| 49 | sh """ |
Zack Williams | 0efdd26 | 2018-06-28 14:17:29 -0700 | [diff] [blame] | 50 | #!/usr/bin/env bash |
| 51 | set -eu -o pipefail |
| 52 | |
| 53 | VERSIONFILE="" # file path to file containing version number |
| 54 | NEW_VERSION="" # version number found in VERSIONFILE |
Zack Williams | 2d0ac6b | 2018-06-29 09:17:41 -0700 | [diff] [blame] | 55 | releaseversion=0 |
Zack Williams | 0efdd26 | 2018-06-28 14:17:29 -0700 | [diff] [blame] | 56 | |
| 57 | function read_version { |
| 58 | if [ -f "VERSION" ] |
| 59 | then |
| 60 | NEW_VERSION=\$(head -n1 "VERSION") |
| 61 | VERSIONFILE="VERSION" |
| 62 | elif [ -f "package.json" ] |
| 63 | then |
| 64 | NEW_VERSION=\$(python -c 'import json,sys;obj=json.load(sys.stdin); print obj["version"]' < package.json) |
| 65 | VERSIONFILE="package.json" |
| 66 | else |
| 67 | echo "ERROR: No versioning file found!" |
| 68 | exit 1 |
| 69 | fi |
| 70 | } |
| 71 | |
| 72 | # check if the version is a released version |
| 73 | function check_if_releaseversion { |
| 74 | if [[ "\$NEW_VERSION" =~ ^([0-9]+)\\.([0-9]+)\\.([0-9]+)\$ ]] |
| 75 | then |
| 76 | echo "Version string '\$NEW_VERSION' in '\$VERSIONFILE' is a SemVer released version!" |
| 77 | releaseversion=1 |
| 78 | else |
| 79 | echo "Version string '\$NEW_VERSION' in '\$VERSIONFILE' is not a SemVer released version, skipping." |
| 80 | fi |
| 81 | } |
| 82 | |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 83 | pushd cord |
| 84 | PROJECT_PATH=\$(xmllint --xpath "string(//project[@name=\\\"${gerritProject}\\\"]/@path)" .repo/manifest.xml) |
| 85 | repo download "\$PROJECT_PATH" "${gerritChangeNumber}/${gerritPatchsetNumber}" |
Zack Williams | 0efdd26 | 2018-06-28 14:17:29 -0700 | [diff] [blame] | 86 | |
| 87 | pushd \$PROJECT_PATH |
| 88 | echo "Existing git tags:" |
| 89 | git tag -n |
| 90 | |
| 91 | read_version |
| 92 | check_if_releaseversion |
| 93 | |
| 94 | # perform checks if a released version |
| 95 | if [ "\$releaseversion" -eq "1" ] |
| 96 | then |
| 97 | git config --global user.email "apitest@opencord.org" |
| 98 | git config --global user.name "API Test" |
| 99 | |
| 100 | git tag -a "\$NEW_VERSION" -m "Tagged for api test on Gerrit patchset: ${gerritChangeNumber}" |
| 101 | |
| 102 | echo "Tags including new tag:" |
| 103 | git tag -n |
| 104 | |
| 105 | fi |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 106 | popd |
Zack Williams | 0efdd26 | 2018-06-28 14:17:29 -0700 | [diff] [blame] | 107 | popd |
| 108 | """ |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 109 | } |
| 110 | } |
| 111 | |
Zack Williams | 0efdd26 | 2018-06-28 14:17:29 -0700 | [diff] [blame] | 112 | |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 113 | stage('prep') { |
| 114 | parallel { |
| 115 | |
| 116 | stage('images') { |
| 117 | steps { |
| 118 | sh ''' |
Kailash Khalasi | 934d39b | 2018-05-30 10:59:49 -0700 | [diff] [blame] | 119 | pushd cord/automation-tools/developer |
Zack Williams | a318503 | 2018-07-03 17:38:33 -0700 | [diff] [blame] | 120 | mkdir ib_logs |
Zack Williams | 7fea572 | 2018-07-03 21:17:47 -0700 | [diff] [blame] | 121 | ./imagebuilder.py -l ib_logs -a ib_actions.yml -g ib_graph.dot -f ../../helm-charts/examples/filter-images.yaml |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 122 | popd |
| 123 | ''' |
Zack Williams | a318503 | 2018-07-03 17:38:33 -0700 | [diff] [blame] | 124 | archiveArtifacts artifacts: 'cord/automation-tools/developer/ib_actions.yml, cord/automation-tools/developer/ib_graph.dot, cord/automation-tools/developer/ib_logs/*', fingerprint: true |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 125 | } |
| 126 | } |
| 127 | |
| 128 | stage('minikube') { |
| 129 | steps { |
| 130 | /* see https://github.com/kubernetes/minikube/#linux-continuous-integration-without-vm-support */ |
| 131 | sh ''' |
| 132 | export MINIKUBE_WANTUPDATENOTIFICATION=false |
| 133 | export MINIKUBE_WANTREPORTERRORPROMPT=false |
| 134 | export CHANGE_MINIKUBE_NONE_USER=true |
| 135 | export MINIKUBE_HOME=$HOME |
| 136 | mkdir -p $HOME/.kube || true |
| 137 | touch $HOME/.kube/config |
| 138 | export KUBECONFIG=$HOME/.kube/config |
| 139 | sudo -E /usr/bin/minikube start --vm-driver=none |
| 140 | ''' |
| 141 | script { |
| 142 | timeout(3) { |
| 143 | waitUntil { |
| 144 | sleep 5 |
| 145 | def kc_ret = sh script: "kubectl get po", returnStatus: true |
| 146 | return (kc_ret == 0); |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 154 | |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 155 | stage('helm') { |
| 156 | steps { |
| 157 | sh ''' |
| 158 | helm init |
| 159 | sleep 60 |
| 160 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/ |
| 161 | ''' |
| 162 | } |
| 163 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 164 | |
| 165 | stage('build') { |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 166 | steps { |
| 167 | sh """ |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 168 | #!/usr/bin/env bash |
| 169 | set -eu -o pipefail |
Kailash Khalasi | 12b2e22 | 2018-06-13 09:45:25 -0700 | [diff] [blame] | 170 | |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 171 | helm_install_args='-f examples/image-tag-candidate.yaml -f examples/imagePullPolicy-IfNotPresent.yaml -f examples/api-test-values.yaml' |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 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 | # Pick which chart(s) to load depending on the project being tested |
| 179 | # In regex, please list repos in same order as requirements.yaml in the chart(s) loaded! |
| 180 | |
| 181 | if [[ "$GERRIT_PROJECT" =~ ^(rcord|onos-service|fabric|olt-service|vsg-hw|vrouter)\$ ]]; then |
| 182 | helm dep update xos-profiles/rcord-lite |
| 183 | helm install \${helm_install_args} xos-profiles/rcord-lite -n rcord-lite |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 184 | |
| 185 | elif [[ "$GERRIT_PROJECT" =~ ^(vMME|vspgwc|vspgwu|vHSS|hss_db|internetemulator|sdn-controller|epc-service|mcord|progran)\$ ]]; then |
Zack Williams | ee86e66 | 2018-07-06 10:18:28 -0700 | [diff] [blame] | 186 | helm dep update xos-profiles/base-openstack |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 187 | helm dep update xos-profiles/mcord |
Zack Williams | ee86e66 | 2018-07-06 10:18:28 -0700 | [diff] [blame] | 188 | helm install \${helm_install_args} xos-profiles/base-openstack -n base-openstack |
| 189 | helm install \${helm_install_args} xos-profiles/mcord -n mcord |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 190 | |
| 191 | elif [[ "$GERRIT_PROJECT" =~ ^(openstack|vtn-service|exampleservice|addressmanager)\$ ]]; then |
| 192 | # NOTE: onos-service is included in base-openstack, but tested w/rcord-lite chart |
| 193 | |
| 194 | helm dep update xos-profiles/base-openstack |
| 195 | helm dep update xos-profiles/demo-exampleservice |
| 196 | helm install \${helm_install_args} xos-profiles/base-openstack -n base-openstack |
| 197 | helm install \${helm_install_args} xos-profiles/demo-exampleservice -n demo-exampleservice |
| 198 | |
| 199 | elif [[ "$GERRIT_PROJECT" =~ ^(kubernetes-service|simpleexampleservice)\$ ]]; then |
| 200 | helm dep update xos-profiles/base-kubernetes |
| 201 | helm dep update xos-profiles/demo-simpleexampleservice |
| 202 | helm install \${helm_install_args} xos-profiles/base-kubernetes -n base-kubernetes |
| 203 | helm install \${helm_install_args} xos-profiles/demo-simpleexampleservice -n demo-simpleexampleservice |
| 204 | |
| 205 | elif [[ "$GERRIT_PROJECT" =~ ^(hippie-oss)\$ ]]; then |
| 206 | helm dep update xos-services/hippie-oss |
| 207 | helm install \${helm_install_args} xos-services/hippie-oss -n hippie-oss |
| 208 | |
Zack Williams | 9d68aa3 | 2018-07-12 11:50:37 -0700 | [diff] [blame] | 209 | elif [[ "$GERRIT_PROJECT" =~ ^(xos|xos-tosca|cord-tester|helm-charts)\$ ]]; then |
Zack Williams | bafed36 | 2018-07-05 16:32:27 -0700 | [diff] [blame] | 210 | echo "No additional charts to install for testing $GERRIT_PROJECT" |
| 211 | |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 212 | else |
| 213 | echo "Couldn't find a chart to test project: $GERRIT_PROJECT!" |
| 214 | exit 1 |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 215 | fi |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 216 | |
Kailash Khalasi | 2bc499b | 2018-07-25 16:10:11 -0700 | [diff] [blame] | 217 | # wait for services to load |
Kailash Khalasi | edb48b1 | 2018-07-31 13:01:01 -0700 | [diff] [blame] | 218 | JOBS_TIMEOUT=900 ./scripts/wait_for_jobs.sh |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 219 | |
| 220 | echo "# Checking helm deployments" |
Kailash Khalasi | 12b2e22 | 2018-06-13 09:45:25 -0700 | [diff] [blame] | 221 | kubectl get pods |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 222 | helm list |
| 223 | |
| 224 | for hchart in \$(helm list -q); |
| 225 | do |
| 226 | echo "## 'helm status' for chart: \${hchart} ##" |
| 227 | helm status "\${hchart}" |
| 228 | done |
| 229 | |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 230 | popd |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 231 | """ |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 232 | } |
| 233 | } |
Kailash Khalasi | 512a7e5 | 2018-07-30 09:12:16 -0700 | [diff] [blame] | 234 | stage('wait for core') { |
| 235 | steps { |
| 236 | timeout(time:5) { |
| 237 | waitUntil { |
| 238 | script { |
| 239 | try { |
| 240 | sh """ |
| 241 | CORE_POD=\$(kubectl get pods | grep xos-core | awk '{print \$1}') |
| 242 | CHAM_POD=\$(kubectl get pods | grep chameleon | awk '{print \$1}') |
| 243 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 244 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 245 | kubectl logs \$CORE_POD | grep "XOS core entering wait loop" |
Kailash Khalasi | 512a7e5 | 2018-07-30 09:12:16 -0700 | [diff] [blame] | 246 | curl -I -u admin@opencord.org:letmein http://\$XOS_CHAMELEON:9101/xosapi/v1/core/users | grep "200 OK" |
Kailash Khalasi | 309872a | 2018-07-31 12:39:02 -0700 | [diff] [blame] | 247 | sleep 30 |
Kailash Khalasi | 25ee072 | 2018-07-30 14:26:41 -0700 | [diff] [blame] | 248 | curl -I -u admin@opencord.org:letmein http://\$XOS_CHAMELEON:9101/xosapi/v1/core/sites | grep "200 OK" |
| 249 | """ |
Kailash Khalasi | 512a7e5 | 2018-07-30 09:12:16 -0700 | [diff] [blame] | 250 | return true |
| 251 | } catch (exception) { |
| 252 | return false |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 259 | |
| 260 | stage('setup') { |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 261 | steps { |
| 262 | sh """ |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 263 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 264 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 265 | 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 |
| 266 | 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 |
| 267 | 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 |
| 268 | 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 | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 269 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 270 | # create additional testing files if services are loaded |
| 271 | if ! [[ "$GERRIT_PROJECT" =~ ^(xos|xos-tosca|cord-tester|helm-charts)\$ ]]; then |
| 272 | export testname=_service_api.robot |
| 273 | export library=_library.robot |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 274 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 275 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 276 | echo \$SERVICES |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 277 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 278 | 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 |
| 279 | |
| 280 | 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 |
| 281 | fi |
| 282 | """ |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 283 | } |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 284 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 285 | |
| 286 | stage('test') { |
| 287 | steps { |
| 288 | sh """ |
| 289 | pushd cord/test/cord-tester/src/test/cord-api/Tests |
| 290 | |
| 291 | CORE_CONTAINER=\$(docker ps | grep k8s_xos-core | awk '{print \$1}') |
| 292 | CHAM_CONTAINER=\$(docker ps | grep k8s_xos-chameleon | awk '{print \$1}') |
| 293 | XOS_CHAMELEON=\$(docker exec \$CHAM_CONTAINER ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 172) |
| 294 | |
| 295 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Properties/ |
| 296 | sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'\$XOS_CHAMELEON\'/\" RestApiProperties.py |
| 297 | sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'9101\'/\" RestApiProperties.py |
| 298 | sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py |
| 299 | sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 300 | sed -i \"s/^\\(PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py |
| 301 | |
| 302 | cd $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame^] | 303 | pybot -d Log -T XOSCoreAPITests.robot || true |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 304 | |
| 305 | # do additional tests if services are loaded |
| 306 | if ! [[ "$GERRIT_PROJECT" =~ ^(xos|xos-tosca|cord-tester|helm-charts)\$ ]]; then |
| 307 | export testname=_service_api.robot |
| 308 | export library=_library.robot |
| 309 | SERVICES=\$(docker exec -i \$CORE_CONTAINER /bin/bash -c "cd /opt/xos/dynamic_services/;find -name '*.xproto'" | awk -F[//] '{print \$2}') |
| 310 | echo \$SERVICES |
| 311 | |
Kailash Khalasi | 07c97a4 | 2018-08-06 12:15:43 -0700 | [diff] [blame^] | 312 | 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] | 313 | fi |
| 314 | |
| 315 | popd |
| 316 | """ |
| 317 | } |
| 318 | } |
| 319 | |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 320 | stage('Publish') { |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 321 | steps { |
| 322 | sh """ |
| 323 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
| 324 | cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/Log/*ml ./RobotLogs |
| 325 | """ |
Zack Williams | c8cfb22 | 2018-07-05 13:29:28 -0700 | [diff] [blame] | 326 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 327 | step([$class: 'RobotPublisher', |
| 328 | disableArchiveOutput: false, |
| 329 | logFileName: 'RobotLogs/log*.html', |
| 330 | otherFiles: '', |
| 331 | outputFileName: 'RobotLogs/output*.xml', |
| 332 | outputPath: '.', |
Kailash Khalasi | ad6cfda | 2018-07-25 11:31:35 -0700 | [diff] [blame] | 333 | passThreshold: 100, |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 334 | reportFileName: 'RobotLogs/report*.html', |
| 335 | unstableThreshold: 0]); |
| 336 | } |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 337 | } |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 338 | |
| 339 | } |
| 340 | |
| 341 | post { |
| 342 | always { |
| 343 | sh ''' |
Kailash Khalasi | ecb4eb6 | 2018-07-31 15:20:19 -0700 | [diff] [blame] | 344 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 345 | do |
| 346 | kubectl logs \$pod > $WORKSPACE/\$pod.log; |
| 347 | done |
| 348 | |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 349 | kubectl get pods --all-namespaces |
| 350 | |
| 351 | echo "# removing helm deployments" |
| 352 | kubectl get pods |
| 353 | helm list |
| 354 | |
| 355 | for hchart in \$(helm list -q); |
| 356 | do |
| 357 | echo "## Purging chart: \${hchart} ##" |
| 358 | helm delete --purge "\${hchart}" |
| 359 | done |
| 360 | |
Zack Williams | f8b356c | 2018-07-17 17:01:27 -0700 | [diff] [blame] | 361 | sudo minikube delete |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 362 | ''' |
Kailash Khalasi | ecb4eb6 | 2018-07-31 15:20:19 -0700 | [diff] [blame] | 363 | archiveArtifacts artifacts: '*.log' |
Zack Williams | fd87d65 | 2018-07-12 14:21:12 -0700 | [diff] [blame] | 364 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "suchitra@opennetworking.org, you@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false]) |
| 365 | } |
| 366 | } |
Kailash Khalasi | 5417081 | 2018-05-24 12:50:22 -0700 | [diff] [blame] | 367 | } |