Kailash | aad7101 | 2019-08-27 10:36:53 -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 | // voltha-2.x e2e tests |
| 16 | // uses kind-voltha to deploy voltha-2.X |
| 17 | // uses bbsim to simulate OLT/ONUs |
| 18 | |
| 19 | pipeline { |
| 20 | |
| 21 | /* no label, executor is determined by JJB */ |
| 22 | agent { |
Zack Williams | b329208 | 2019-10-11 17:15:18 -0700 | [diff] [blame] | 23 | label "${params.buildNode}" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 24 | } |
| 25 | options { |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 26 | timeout(time: 90, unit: 'MINUTES') |
| 27 | } |
| 28 | environment { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 29 | PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 30 | VOLTHA_LOG_LEVEL="DEBUG" |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 31 | FANCY=0 |
| 32 | WITH_SIM_ADAPTERS="n" |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 33 | NAME="test" |
| 34 | VOLTCONFIG="$HOME/.volt/config-$NAME" |
| 35 | KUBECONFIG="$HOME/.kube/kind-config-voltha-$NAME" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | stages { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 39 | stage('Clone kind-voltha') { |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 40 | steps { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 41 | checkout([ |
| 42 | $class: 'GitSCM', |
| 43 | userRemoteConfigs: [[ |
| 44 | url: "https://gerrit.opencord.org/kind-voltha", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 45 | refspec: "${kindVolthaChange}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 46 | ]], |
| 47 | branches: [[ name: "master", ]], |
| 48 | extensions: [ |
| 49 | [$class: 'WipeWorkspace'], |
| 50 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 51 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 52 | ], |
| 53 | ]) |
Matteo Scandolo | 57a0663 | 2020-09-18 18:38:54 -0700 | [diff] [blame] | 54 | sh """ |
| 55 | if [ '${kindVolthaChange}' != '' ] ; then |
| 56 | cd $WORKSPACE/kind-voltha |
| 57 | git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD |
| 58 | fi |
| 59 | """ |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 60 | } |
| 61 | } |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 62 | stage('Clone voltha-system-tests') { |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 63 | steps { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 64 | checkout([ |
| 65 | $class: 'GitSCM', |
| 66 | userRemoteConfigs: [[ |
| 67 | url: "https://gerrit.opencord.org/voltha-system-tests", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 68 | refspec: "${volthaSystemTestsChange}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 69 | ]], |
| 70 | branches: [[ name: "${branch}", ]], |
| 71 | extensions: [ |
| 72 | [$class: 'WipeWorkspace'], |
| 73 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 74 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 75 | ], |
| 76 | ]) |
Matteo Scandolo | 57a0663 | 2020-09-18 18:38:54 -0700 | [diff] [blame] | 77 | sh """ |
| 78 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 79 | cd $WORKSPACE/voltha-system-tests |
| 80 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 81 | fi |
| 82 | """ |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 83 | } |
| 84 | } |
Matteo Scandolo | 8fc674c | 2020-09-14 18:05:37 -0700 | [diff] [blame] | 85 | // If the repo under test is not kind-voltha |
| 86 | // then download it and checkout the patch |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 87 | stage('Download Patch') { |
Matteo Scandolo | 8fc674c | 2020-09-14 18:05:37 -0700 | [diff] [blame] | 88 | when { |
| 89 | expression { |
| 90 | return "${gerritProject}" != 'kind-voltha'; |
| 91 | } |
| 92 | } |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 93 | steps { |
| 94 | checkout([ |
| 95 | $class: 'GitSCM', |
| 96 | userRemoteConfigs: [[ |
| 97 | url: "https://gerrit.opencord.org/${gerritProject}", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 98 | refspec: "${gerritRefspec}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 99 | ]], |
| 100 | branches: [[ name: "${branch}", ]], |
| 101 | extensions: [ |
| 102 | [$class: 'WipeWorkspace'], |
| 103 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "${gerritProject}"], |
| 104 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 105 | ], |
| 106 | ]) |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 107 | sh """ |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 108 | pushd $WORKSPACE/${gerritProject} |
Matteo Scandolo | 57a0663 | 2020-09-18 18:38:54 -0700 | [diff] [blame] | 109 | git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD |
| 110 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 111 | echo "Currently on commit: \n" |
| 112 | git log -1 --oneline |
| 113 | popd |
| 114 | """ |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 115 | } |
| 116 | } |
Matteo Scandolo | 8fc674c | 2020-09-14 18:05:37 -0700 | [diff] [blame] | 117 | // If the repo under test is kind-voltha we don't need to download it again, |
| 118 | // as we already have it, simply checkout the patch |
| 119 | stage('Checkout kind-voltha patch') { |
| 120 | when { |
| 121 | expression { |
| 122 | return "${gerritProject}" == 'kind-voltha'; |
| 123 | } |
| 124 | } |
| 125 | steps { |
| 126 | sh """ |
| 127 | cd $WORKSPACE/kind-voltha |
| 128 | git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD |
| 129 | """ |
| 130 | } |
| 131 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 132 | stage('Create K8s Cluster') { |
| 133 | steps { |
| 134 | sh """ |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 135 | if [ "${branch}" != "master" ]; then |
| 136 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 137 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 138 | else |
| 139 | echo "on master, using default settings for kind-voltha" |
| 140 | fi |
| 141 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 142 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 143 | JUST_K8S=y ./voltha up |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 144 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 145 | """ |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | stage('Build Images') { |
| 150 | steps { |
| 151 | sh """ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 152 | make-local () { |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 153 | make -C $WORKSPACE/\$1 DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 154 | } |
Andy Bavier | 0ed7706 | 2020-02-18 10:09:19 -0700 | [diff] [blame] | 155 | if [ "${gerritProject}" = "pyvoltha" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 156 | make -C $WORKSPACE/pyvoltha/ dist |
| 157 | export LOCAL_PYVOLTHA=$WORKSPACE/pyvoltha/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 158 | make-local voltha-openonu-adapter |
| 159 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 160 | make -C $WORKSPACE/voltha-lib-go/ build |
| 161 | export LOCAL_LIB_GO=$WORKSPACE/voltha-lib-go/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 162 | make-local voltha-go |
| 163 | make-local voltha-openolt-adapter |
| 164 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 165 | make -C $WORKSPACE/voltha-protos/ build |
| 166 | export LOCAL_PROTOS=$WORKSPACE/voltha-protos/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 167 | make-local voltha-go |
| 168 | make-local voltha-openolt-adapter |
| 169 | make-local voltha-openonu-adapter |
| 170 | make-local ofagent-py |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 171 | elif [ "${gerritProject}" = "voltctl" ]; then |
Andy Bavier | decde3f | 2020-04-01 15:29:43 -0700 | [diff] [blame] | 172 | # Set and handle GOPATH and PATH |
| 173 | export GOPATH=\${GOPATH:-$WORKSPACE/go} |
| 174 | export PATH=\$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:\$GOPATH/bin |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 175 | make -C $WORKSPACE/voltctl/ build |
Andy Bavier | 4318f8d | 2020-04-09 13:50:53 -0700 | [diff] [blame] | 176 | elif ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|kind-voltha)\$ ]]; then |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 177 | make-local ${gerritProject} |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 178 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 179 | """ |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | stage('Push Images') { |
| 184 | steps { |
| 185 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 186 | if [ "${branch}" != "master" ]; then |
| 187 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 188 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 189 | else |
| 190 | echo "on master, using default settings for kind-voltha" |
| 191 | fi |
| 192 | |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 193 | if ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|voltctl|kind-voltha)\$ ]]; then |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 194 | export GOROOT=/usr/local/go |
| 195 | export GOPATH=\$(pwd) |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 196 | docker images | grep citest |
Matteo Scandolo | 2e64c10 | 2020-07-29 19:41:02 -0700 | [diff] [blame] | 197 | for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$NAME --nodes voltha-\$NAME-worker,voltha-\$NAME-worker2; done |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 198 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 199 | ''' |
| 200 | } |
| 201 | } |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 202 | |
| 203 | stage('ATT workflow') { |
| 204 | environment { |
| 205 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow" |
| 206 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 207 | steps { |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 208 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 209 | if [ "${branch}" != "master" ]; then |
| 210 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 211 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 212 | else |
| 213 | echo "on master, using default settings for kind-voltha" |
| 214 | fi |
| 215 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 216 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 217 | export EXTRA_HELM_FLAGS+="--set defaults.image_tag=null " |
| 218 | fi |
| 219 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 220 | # Workflow-specific flags |
| 221 | export WITH_RADIUS=yes |
| 222 | export WITH_BBSIM=yes |
| 223 | export DEPLOY_K8S=yes |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 224 | export CONFIG_SADIS="external" |
| 225 | export BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 226 | |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 227 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 228 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 229 | IMAGES="" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 230 | if [ "${gerritProject}" = "voltha-go" ]; then |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 231 | IMAGES="rw_core ro_core " |
| 232 | elif [ "${gerritProject}" = "ofagent-py" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 233 | IMAGES="ofagent_py " |
| 234 | EXTRA_HELM_FLAGS+="--set use_ofagent_go=false " |
Andy Bavier | 9c412a8 | 2020-03-23 12:00:28 -0700 | [diff] [blame] | 235 | elif [ "${gerritProject}" = "ofagent-go" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 236 | IMAGES="ofagent_go " |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 237 | elif [ "${gerritProject}" = "voltha-onos" ]; then |
| 238 | IMAGES="onos " |
| 239 | elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then |
| 240 | IMAGES="adapter_open_olt " |
| 241 | elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then |
| 242 | IMAGES="adapter_open_onu " |
| 243 | elif [ "${gerritProject}" = "voltha-api-server" ]; then |
| 244 | IMAGES="afrouter afrouterd " |
| 245 | elif [ "${gerritProject}" = "bbsim" ]; then |
| 246 | IMAGES="bbsim " |
Andy Bavier | ec0c10d | 2020-02-14 13:06:27 -0700 | [diff] [blame] | 247 | elif [ "${gerritProject}" = "pyvoltha" ]; then |
| 248 | IMAGES="adapter_open_onu " |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 249 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
| 250 | IMAGES="rw_core ro_core adapter_open_olt " |
| 251 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
| 252 | IMAGES="rw_core ro_core adapter_open_olt adapter_open_onu ofagent " |
Zack Williams | 0499750 | 2019-10-04 14:32:20 -0700 | [diff] [blame] | 253 | else |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 254 | echo "No images to push" |
Scott Baker | 9ac2371 | 2019-10-02 09:26:50 -0700 | [diff] [blame] | 255 | fi |
| 256 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 257 | for I in \$IMAGES |
| 258 | do |
| 259 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 260 | done |
| 261 | |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 262 | if [ "${gerritProject}" = "voltha-helm-charts" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 263 | export CHART_PATH=$WORKSPACE/voltha-helm-charts |
Andy Bavier | 4540634 | 2019-10-02 16:45:40 -0700 | [diff] [blame] | 264 | export VOLTHA_CHART=\$CHART_PATH/voltha |
| 265 | export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt |
| 266 | export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 267 | helm dep update \$VOLTHA_CHART |
| 268 | helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART |
| 269 | helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART |
| 270 | fi |
| 271 | |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 272 | if [ "${gerritProject}" = "voltctl" ]; then |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 273 | export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION) |
| 274 | cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl |
| 275 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 276 | fi |
| 277 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 278 | printenv |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 279 | |
| 280 | # start logging |
| 281 | mkdir -p $WORKSPACE/att |
| 282 | _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log & |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 283 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 284 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 285 | ./voltha up |
| 286 | |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 287 | # $NAME-env.sh contains the environment we used |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 288 | # Save value of EXTRA_HELM_FLAGS there to use in subsequent stages |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 289 | echo export EXTRA_HELM_FLAGS=\\"\$EXTRA_HELM_FLAGS\\" >> $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 290 | |
| 291 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 292 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 293 | |
| 294 | # By default, all tests tagged 'sanity' are run. This covers basic functionality |
| 295 | # like running through the ATT workflow for a single subscriber. |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 296 | export TARGET=sanity-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 297 | |
| 298 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 299 | # functional test suite. This covers tests tagged either 'sanity' or 'functional'. |
| 300 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 301 | REGEX="functional tests" |
| 302 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 303 | TARGET=functional-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 304 | fi |
| 305 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 306 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 307 | |
| 308 | # stop logging |
| 309 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 310 | if [ -n "$P_IDS" ]; then |
| 311 | echo $P_IDS |
| 312 | for P_ID in $P_IDS; do |
| 313 | kill -9 $P_ID |
| 314 | done |
| 315 | fi |
| 316 | |
| 317 | # get pods information |
| 318 | kubectl get pods -o wide > $WORKSPACE/att/pods.txt || true |
| 319 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-images.txt || true |
| 320 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-imagesId.txt || true |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 321 | ''' |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | stage('DT workflow') { |
| 326 | environment { |
| 327 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow" |
| 328 | } |
| 329 | steps { |
| 330 | sh ''' |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 331 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 332 | source $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 333 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 334 | |
| 335 | # Workflow-specific flags |
| 336 | export WITH_RADIUS=no |
| 337 | export WITH_EAPOL=no |
| 338 | export WITH_DHCP=no |
| 339 | export WITH_IGMP=no |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 340 | export CONFIG_SADIS="external" |
| 341 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 342 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 343 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 344 | export EXTRA_HELM_FLAGS+="--set defaults.image_tag=null " |
| 345 | fi |
| 346 | |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 347 | # start logging |
| 348 | mkdir -p $WORKSPACE/dt |
| 349 | _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log & |
| 350 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 351 | DEPLOY_K8S=n ./voltha up |
| 352 | |
| 353 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 354 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 355 | |
| 356 | # By default, all tests tagged 'sanityDt' are run. This covers basic functionality |
| 357 | # like running through the DT workflow for a single subscriber. |
| 358 | export TARGET=sanity-kind-dt |
| 359 | |
| 360 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 361 | # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'. |
| 362 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 363 | REGEX="functional tests" |
| 364 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 365 | TARGET=functional-single-kind-dt |
| 366 | fi |
| 367 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 368 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 369 | |
| 370 | # stop logging |
| 371 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')" |
| 372 | if [ -n "$P_IDS" ]; then |
| 373 | echo $P_IDS |
| 374 | for P_ID in $P_IDS; do |
| 375 | kill -9 $P_ID |
| 376 | done |
| 377 | fi |
| 378 | |
| 379 | # get pods information |
| 380 | kubectl get pods -o wide > $WORKSPACE/dt/pods.txt || true |
| 381 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-images.txt || true |
| 382 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-imagesId.txt || true |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 383 | ''' |
| 384 | } |
| 385 | } |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 386 | |
| 387 | stage('TT workflow') { |
| 388 | environment { |
| 389 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow" |
| 390 | } |
| 391 | steps { |
| 392 | sh ''' |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 393 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 394 | source $NAME-env.sh |
| 395 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 396 | |
| 397 | # Workflow-specific flags |
| 398 | export WITH_RADIUS=no |
| 399 | export WITH_EAPOL=no |
| 400 | export WITH_DHCP=yes |
| 401 | export WITH_IGMP=yes |
| 402 | export CONFIG_SADIS="external" |
| 403 | export BBSIM_CFG="configs/bbsim-sadis-tt.yaml" |
| 404 | |
Matteo Scandolo | f72f4d1 | 2020-12-14 09:53:28 -1000 | [diff] [blame] | 405 | if [[ "${gerritProject}" == voltha-helm-charts ]]; then |
| 406 | export EXTRA_HELM_FLAGS+="--set defaults.image_tag=null " |
| 407 | fi |
| 408 | |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 409 | # start logging |
| 410 | mkdir -p $WORKSPACE/tt |
| 411 | _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log & |
| 412 | |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 413 | DEPLOY_K8S=n ./voltha up |
| 414 | |
| 415 | mkdir -p $ROBOT_LOGS_DIR |
| 416 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 417 | |
| 418 | # By default, all tests tagged 'sanityTt' are run. This covers basic functionality |
| 419 | # like running through the TT workflow for a single subscriber. |
| 420 | export TARGET=sanity-kind-tt |
| 421 | |
| 422 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 423 | # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'. |
| 424 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 425 | REGEX="functional tests" |
| 426 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 427 | TARGET=functional-single-kind-tt |
| 428 | fi |
| 429 | |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 430 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 431 | |
| 432 | # stop logging |
| 433 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 434 | if [ -n "$P_IDS" ]; then |
| 435 | echo $P_IDS |
| 436 | for P_ID in $P_IDS; do |
| 437 | kill -9 $P_ID |
| 438 | done |
| 439 | fi |
| 440 | |
| 441 | # get pods information |
| 442 | kubectl get pods -o wide > $WORKSPACE/tt/pods.txt || true |
| 443 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-images.txt || true |
| 444 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-imagesId.txt || true |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 445 | ''' |
| 446 | } |
| 447 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 448 | } |
| 449 | |
| 450 | post { |
| 451 | always { |
| 452 | sh ''' |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 453 | set +e |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 454 | cp $WORKSPACE/kind-voltha/install-$NAME.log $WORKSPACE/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 455 | |
| 456 | sync |
Matteo Scandolo | 9aae495 | 2020-09-14 13:05:53 -0700 | [diff] [blame] | 457 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 458 | |
| 459 | ## Pull out errors from log files |
| 460 | extract_errors_go() { |
| 461 | echo |
| 462 | echo "Error summary for $1:" |
| 463 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 464 | echo |
| 465 | } |
| 466 | |
| 467 | extract_errors_python() { |
| 468 | echo |
| 469 | echo "Error summary for $1:" |
| 470 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 471 | echo |
| 472 | } |
| 473 | |
| 474 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 475 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 476 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 477 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 478 | |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 479 | gzip $WORKSPACE/att/onos-voltha-combined.log |
| 480 | gzip $WORKSPACE/dt/onos-voltha-combined.log |
| 481 | gzip $WORKSPACE/tt/onos-voltha-combined.log |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 482 | ''' |
| 483 | step([$class: 'RobotPublisher', |
| 484 | disableArchiveOutput: false, |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 485 | logFileName: 'RobotLogs/*/log*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 486 | otherFiles: '', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 487 | outputFileName: 'RobotLogs/*/output*.xml', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 488 | outputPath: '.', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 489 | passThreshold: 100, |
| 490 | reportFileName: 'RobotLogs/*/report*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 491 | unstableThreshold: 0]); |
Matteo Scandolo | bafd4f0 | 2020-12-09 12:14:55 -0800 | [diff] [blame] | 492 | archiveArtifacts artifacts: '*.log,**/*.log,**/*.gz,*.gz' |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 493 | } |
| 494 | } |
| 495 | } |